- 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"); puts(" - Neue Nummern");
renumber(); renumber();
for (r = regions;r;r=r->next) reorder_owners(r); for (r = regions;r;r=r->next) reorder_owners(r);
puts(" - Attribute altern"); puts(" - Attribute altern");

View File

@ -550,6 +550,7 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
char marker; char marker;
int dh; int dh;
boolean isbattle = (boolean)(mode == see_battle); boolean isbattle = (boolean)(mode == see_battle);
if (u->race == new_race[RC_SPELL]) return; if (u->race == new_race[RC_SPELL]) return;
{ {
@ -579,7 +580,6 @@ rpunit(FILE * F, const faction * f, const unit * u, int indent, int mode)
if (!isbattle) { if (!isbattle) {
print_curses(F, f, u, TYP_UNIT, indent); print_curses(F, f, u, TYP_UNIT, indent);
} }
} }
static void static void
@ -1658,8 +1658,9 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
#ifdef WDW_PYRAMID #ifdef WDW_PYRAMID
if (i != '!' && i != '?' && i != '.') if (i != '!' && i != '?' && i != '.') {
scat(", "); scat(", ");
}
if (b->type == bt_find("pyramid")) { if (b->type == bt_find("pyramid")) {
unit * owner = buildingowner(r, b); unit * owner = buildingowner(r, b);
@ -1718,15 +1719,18 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
print_curses(F, f, b, TYP_BUILDING, 4); print_curses(F, f, b, TYP_BUILDING, 4);
for (u = r->units; u; u = u->next) for (u = r->units; u; u = u->next) {
if (u->building == b && fval(u, UFL_OWNER)) { if (u->building == b) {
assert(fval(u, UFL_OWNER) || !"you must call reorder_owners() first!");
rpunit(F, f, u, 6, mode); rpunit(F, f, u, 6, mode);
u = u->next;
break; 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); rpunit(F, f, u, 6, mode);
} }
}
int int
report_plaintext(const char * filename, report_context * ctx) report_plaintext(const char * filename, report_context * ctx)

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))); strcpy(lbuf, locale_string(loc, mkname("prefix", prefix)));
s += strlen(lbuf); s += strlen(lbuf);
if (asyn!=NULL) { if (asyn!=NULL) {
strcpy(s, locale_string(loc, strcpy(s, LOC(loc, ((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
} else { } else {
strcpy(s, LOC(loc, rc_name(rc, u->number != 1))); strcpy(s, LOC(loc, rc_name(rc, u->number != 1)));
} }
s[0] = (char)tolower(s[0]); s[0] = (char)tolower(s[0]);
return lbuf; return lbuf;
} else if (asyn!=NULL) { } else if (asyn!=NULL) {
return(locale_string(loc, return(LOC(loc, ((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
((frace_synonyms *)(asyn->data.v))->synonyms[u->number != 1]));
} }
return LOC(loc, rc_name(rc, u->number != 1)); return LOC(loc, rc_name(rc, u->number != 1));
} }