- report_building() faster

- indentation cleanup
This commit is contained in:
Enno Rehling 2006-02-20 21:24:09 +00:00
parent b7552f0d06
commit 2ab8cc7564
4 changed files with 197 additions and 196 deletions

View File

@ -4051,7 +4051,6 @@ processorders (void)
puts(" - Neue Nummern");
renumber();
for (r = regions;r;r=r->next) reorder_owners(r);
puts(" - Attribute altern");

View File

@ -550,7 +550,8 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
char marker;
int dh;
boolean isbattle = (boolean)(mode == see_battle);
if(u->race == new_race[RC_SPELL]) return;
if (u->race == new_race[RC_SPELL]) return;
{
rnl(F);
@ -559,14 +560,14 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
a_otherfaction = a_find(u->attribs, &at_otherfaction);
if(u->faction == f) {
if (u->faction == f) {
marker = '*';
} else {
if(a_otherfaction && f != u->faction && get_otherfaction(a_otherfaction) == f
if (a_otherfaction && f != u->faction && get_otherfaction(a_otherfaction) == f
&& !fval(u, UFL_PARTEITARNUNG)) {
marker = '!';
} else {
if(dh && !fval(u, UFL_PARTEITARNUNG)) {
if (dh && !fval(u, UFL_PARTEITARNUNG)) {
marker = '+';
} else {
marker = '-';
@ -576,10 +577,9 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
rparagraph(F, buf, indent, 0, marker);
if(!isbattle){
if (!isbattle) {
print_curses(F, f, u, TYP_UNIT, indent);
}
}
static void
@ -1658,8 +1658,9 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
#ifdef WDW_PYRAMID
if (i != '!' && i != '?' && i != '.')
if (i != '!' && i != '?' && i != '.') {
scat(", ");
}
if (b->type == bt_find("pyramid")) {
unit * owner = buildingowner(r, b);
@ -1718,14 +1719,17 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
print_curses(F, f, b, TYP_BUILDING, 4);
for (u = r->units; u; u = u->next)
if (u->building == b && fval(u, UFL_OWNER)) {
for (u = r->units; u; u = u->next) {
if (u->building == b) {
assert(fval(u, UFL_OWNER) || !"you must call reorder_owners() first!");
rpunit(F, f, u, 6, mode);
u = u->next;
break;
}
for (u = r->units; u; u = u->next)
if (u->building == b && !fval(u, UFL_OWNER))
}
for (;u!=NULL && u->building==b;u=u->next) {
rpunit(F, f, u, 6, mode);
}
}
int

View File

@ -2964,14 +2964,14 @@ reorder_owners(region * r)
unit ** insert;
if (fval(u, UFL_OWNER)) {
unit * nu = *ubegin;
insert=ubegin;
insert = ubegin;
if (nu!=u && nu->building==u->building && fval(nu, UFL_OWNER)) {
log_error(("[reorder_owners] %s hat mehrere Besitzer mit UFL_OWNER.\n", buildingname(nu->building)));
freset(nu, UFL_OWNER);
}
}
else insert = uend;
if (insert!=useek) {
if (insert != useek) {
*useek = u->next; /* raus aus der liste */
u->next = *insert;
*insert = u;

View File

@ -303,16 +303,14 @@ racename(const struct locale *loc, const unit *u, const race * rc)
strcpy(lbuf, locale_string(loc, mkname("prefix", prefix)));
s += strlen(lbuf);
if (asyn!=NULL) {
strcpy(s, locale_string(loc,
((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
strcpy(s, LOC(loc, ((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
} else {
strcpy(s, LOC(loc, rc_name(rc, u->number != 1)));
}
s[0] = (char)tolower(s[0]);
return lbuf;
} else if (asyn!=NULL) {
return(locale_string(loc,
((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
return(LOC(loc, ((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
}
return LOC(loc, rc_name(rc, u->number != 1));
}