- indentation fixes

- statistics beautification
This commit is contained in:
Enno Rehling 2006-01-29 14:05:28 +00:00
parent 7819848524
commit 7a3ca3ce5b
3 changed files with 262 additions and 258 deletions

View file

@ -1009,9 +1009,9 @@ describe(FILE * F, const region * r, int partial, faction * f)
/* Terrain */ /* Terrain */
bufp += strxcpy(bufp, ", "); bufp += strxcpy(bufp, ", ");
if(is_cursed(r->attribs,C_MAELSTROM, 0)) if (is_cursed(r->attribs,C_MAELSTROM, 0)) {
tname = "maelstrom"; tname = "maelstrom";
else { } else {
tname = terrain_name(r); tname = terrain_name(r);
} }
bufp += strxcpy(bufp, LOC(f->locale, tname)); bufp += strxcpy(bufp, LOC(f->locale, tname));
@ -1024,17 +1024,19 @@ describe(FILE * F, const region * r, int partial, faction * f)
if (trees > 0 || ytrees > 0) { if (trees > 0 || ytrees > 0) {
bufp += sprintf(bufp, ", %d/%d ", trees, ytrees); bufp += sprintf(bufp, ", %d/%d ", trees, ytrees);
if (fval(r, RF_MALLORN)) { if (fval(r, RF_MALLORN)) {
if (trees == 1) if (trees == 1) {
bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree")); bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree"));
else } else {
bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree_p")); bufp += strxcpy(bufp, LOC(f->locale, "nr_mallorntree_p"));
} }
else if (trees == 1) }
else if (trees == 1) {
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree")); bufp += strxcpy(bufp, LOC(f->locale, "nr_tree"));
else } else {
bufp += strxcpy(bufp, LOC(f->locale, "nr_tree_p")); bufp += strxcpy(bufp, LOC(f->locale, "nr_tree_p"));
} }
} }
}
/* iron & stone */ /* iron & stone */
if (partial == 0 && f != (faction *) NULL) { if (partial == 0 && f != (faction *) NULL) {
@ -1101,9 +1103,10 @@ describe(FILE * F, const region * r, int partial, faction * f)
bufp += strxcpy(bufp, r->display); bufp += strxcpy(bufp, r->display);
n = r->display[strlen(r->display) - 1]; n = r->display[strlen(r->display) - 1];
if (n != '!' && n != '?' && n != '.') if (n != '!' && n != '?' && n != '.') {
strcpy(bufp++, "."); strcpy(bufp++, ".");
} }
}
{ {
const faction * owner = region_owner(r); const faction * owner = region_owner(r);
@ -1250,39 +1253,39 @@ statistics(FILE * F, const region * r, const faction * f)
number = 0; number = 0;
/* zählen */ /* zählen */
for (u = r->units; u; u = u->next) for (u = r->units; u; u = u->next) {
if (u->faction == f && u->race != new_race[RC_SPELL]) { if (u->faction == f && u->race != new_race[RC_SPELL]) {
for (itm=u->items;itm;itm=itm->next) { for (itm=u->items;itm;itm=itm->next) {
i_change(&items, itm->type, itm->number); i_change(&items, itm->type, itm->number);
} }
number += u->number; number += u->number;
} }
}
/* Ausgabe */ /* Ausgabe */
rnl(F); rnl(F);
m = msg_message("nr_stat_header", "region", r); m = msg_message("nr_stat_header", "region", r);
nr_render(m, f->locale, buf, sizeof(buf), f); nr_render(m, f->locale, buf, sizeof(buf), f);
rps(F, buf);
msg_release(m); msg_release(m);
rparagraph(F, buf, 0, 0);
rnl(F); rnl(F);
/* Region */ /* Region */
if (fval(r->terrain, LAND_REGION) && rmoney(r)) { if (fval(r->terrain, LAND_REGION) && rmoney(r)) {
m = msg_message("nr_stat_maxentertainment", "max", entertainmoney(r)); m = msg_message("nr_stat_maxentertainment", "max", entertainmoney(r));
nr_render(m, f->locale, buf, sizeof(buf), f); nr_render(m, f->locale, buf, sizeof(buf), f);
rps(F, buf); rparagraph(F, buf, 2, 0);
msg_release(m); msg_release(m);
} }
if (production(r) && (!fval(r->terrain, SEA_REGION) || f->race == new_race[RC_AQUARIAN])) { if (production(r) && (!fval(r->terrain, SEA_REGION) || f->race == new_race[RC_AQUARIAN])) {
m = msg_message("nr_stat_salary", "max", wage(r, f, f->race)); m = msg_message("nr_stat_salary", "max", wage(r, f, f->race));
nr_render(m, f->locale, buf, sizeof(buf), f); nr_render(m, f->locale, buf, sizeof(buf), f);
rps(F, buf); rparagraph(F, buf, 2, 0);
msg_release(m); msg_release(m);
} }
if (p) { if (p) {
m = msg_message("nr_stat_recruits", "max", p / RECRUITFRACTION); m = msg_message("nr_stat_recruits", "max", p / RECRUITFRACTION);
nr_render(m, f->locale, buf, sizeof(buf), f); nr_render(m, f->locale, buf, sizeof(buf), f);
rps(F, buf); rparagraph(F, buf, 2, 0);
msg_release(m); msg_release(m);
if (!TradeDisabled()) { if (!TradeDisabled()) {
@ -1294,7 +1297,7 @@ statistics(FILE * F, const region * r, const faction * f)
p / TRADE_FRACTION); p / TRADE_FRACTION);
} }
nr_render(m, f->locale, buf, sizeof(buf), f); nr_render(m, f->locale, buf, sizeof(buf), f);
rps(F, buf); rparagraph(F, buf, 2, 0);
msg_release(m); msg_release(m);
} }
} }
@ -1302,14 +1305,14 @@ statistics(FILE * F, const region * r, const faction * f)
m = msg_message("nr_stat_people", "max", number); m = msg_message("nr_stat_people", "max", number);
nr_render(m, f->locale, buf, sizeof(buf), f); nr_render(m, f->locale, buf, sizeof(buf), f);
rps(F, buf); rparagraph(F, buf, 2, 0);
msg_release(m); msg_release(m);
for (itm = items; itm; itm=itm->next) { for (itm = items; itm; itm=itm->next) {
sprintf(buf, "%s: %d", sprintf(buf, "%s: %d",
LOC(f->locale, resourcename(itm->type->rtype, GR_PLURAL)), LOC(f->locale, resourcename(itm->type->rtype, GR_PLURAL)),
itm->number); itm->number);
rps(F, buf); rparagraph(F, buf, 2, 0);
} }
while (items) i_free(i_remove(&items, items)); while (items) i_free(i_remove(&items, items));
} }

View file

@ -336,10 +336,11 @@ create_mage(unit * u, magic_t mtyp)
sc_mage *mage; sc_mage *mage;
attrib *a; attrib *a;
#ifndef NDEBUG
a = a_find(u->attribs, &at_mage); a = a_find(u->attribs, &at_mage);
assert(a==NULL); if (a!=NULL) {
#endif mage = a->data.v;
assert(mage->spells==NULL && mage->magietyp == mtyp);
}
a = a_add(&u->attribs, a_new(&at_mage)); a = a_add(&u->attribs, a_new(&at_mage));
mage = a->data.v; mage = a->data.v;

View file

@ -464,9 +464,9 @@
<type> <type>
<arg name="max" type="int"/> <arg name="max" type="int"/>
</type> </type>
<text locale="de">"Rekruten: max. $int($max) Bauern."</text> <text locale="de">"Rekruten: max. $int($max) Bauern"</text>
<text locale="en">"Recruits: $int($max) peasants."</text> <text locale="en">"Recruits: $int($max) peasants"</text>
<text locale="fr">"Recruits: $int($max) peasants."</text> <text locale="fr">"Recruits: $int($max) peasants"</text>
</message> </message>
<message name="nr_score" section="nr"> <message name="nr_score" section="nr">
<type> <type>