fixed formatting errors

This commit is contained in:
Steffen Mecke 2015-01-30 20:43:40 +01:00
parent 039ee159cb
commit 5e4ea5a145

View file

@ -634,8 +634,8 @@ int indent)
for (; a; a = a->next) { for (; a; a = a->next) {
char buf[4096]; char buf[4096];
message *msg; message *msg;
if (fval(a->type, ATF_CURSE)) { if (fval(a->type, ATF_CURSE)) {
curse *c = (curse *)a->data.v; curse *c = (curse *)a->data.v;
@ -654,10 +654,11 @@ int indent)
else if (a->type == &at_effect && self) { else if (a->type == &at_effect && self) {
effect_data *data = (effect_data *)a->data.v; effect_data *data = (effect_data *)a->data.v;
if (data->value > 0) { if (data->value > 0) {
msg = msg_message("nr_potion_effect", "potion left", data->type->itype->rtype, data->value); msg = msg_message("nr_potion_effect", "potion left",
nr_render(msg, viewer->locale, buf, sizeof(buf), viewer); data->type->itype->rtype, data->value);
rparagraph(F, buf, indent, 2, 0); nr_render(msg, viewer->locale, buf, sizeof(buf), viewer);
msg_release(msg); rparagraph(F, buf, indent, 2, 0);
msg_release(msg);
} }
} }
} }
@ -823,41 +824,43 @@ static void prices(FILE * F, const region * r, const faction * f)
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
for (dmd = r->land->demands; dmd; dmd = dmd->next) for (dmd = r->land->demands; dmd; dmd = dmd->next){
if (dmd->value > 0) { if (dmd->value > 0) {
m = msg_message("nr_market_price", "product price", m = msg_message("nr_market_price", "product price",
dmd->type->itype->rtype, dmd->value * dmd->type->price); dmd->type->itype->rtype, dmd->value * dmd->type->price);
bytes = (int)nr_render(m, f->locale, bufp, size, f); bytes = (int)nr_render(m, f->locale, bufp, size, f);
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
msg_release(m); msg_release(m);
n--; n--;
if (n == 0) { if (n == 0) {
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_end"), size); bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_end"),
if (wrptr(&bufp, &size, bytes) != 0) size);
WARN_STATIC_BUFFER(); if (wrptr(&bufp, &size, bytes) != 0)
} WARN_STATIC_BUFFER();
else if (n == 1) { } else if (n == 1) {
bytes = (int)strlcpy(bufp, " ", size); bytes = (int)strlcpy(bufp, " ", size);
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_final"), size); bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_final"),
if (wrptr(&bufp, &size, bytes) != 0) size);
WARN_STATIC_BUFFER(); if (wrptr(&bufp, &size, bytes) != 0)
bytes = (int)strlcpy(bufp, " ", size); WARN_STATIC_BUFFER();
if (wrptr(&bufp, &size, bytes) != 0) bytes = (int)strlcpy(bufp, " ", size);
WARN_STATIC_BUFFER(); if (wrptr(&bufp, &size, bytes) != 0)
} WARN_STATIC_BUFFER();
else { } else {
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"), size); bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"),
if (wrptr(&bufp, &size, bytes) != 0) size);
WARN_STATIC_BUFFER(); if (wrptr(&bufp, &size, bytes) != 0)
bytes = (int)strlcpy(bufp, " ", size); WARN_STATIC_BUFFER();
if (wrptr(&bufp, &size, bytes) != 0) bytes = (int)strlcpy(bufp, " ", size);
WARN_STATIC_BUFFER(); if (wrptr(&bufp, &size, bytes) != 0)
} WARN_STATIC_BUFFER();
}
} }
} }
}
/* Schreibe Paragraphen */ /* Schreibe Paragraphen */
*bufp = 0; *bufp = 0;
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
@ -1096,12 +1099,12 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
if (rule_region_owners()) { if (rule_region_owners()) {
const faction *owner = region_get_owner(r); const faction *owner = region_get_owner(r);
message *msg; message *msg;
if (owner != NULL) { if (owner != NULL) {
msg = msg_message("nr_region_owner", "faction", owner); msg = msg_message("nr_region_owner", "faction", owner);
bytes = (int)nr_render(msg, f->locale, bufp, size, f); bytes = (int)nr_render(msg, f->locale, bufp, size, f);
msg_release(msg); msg_release(msg);
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} }
@ -1207,7 +1210,7 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
bufp = buf; bufp = buf;
size = sizeof(buf) - 1; size = sizeof(buf) - 1;
// this localization might not work for every language but is fine for de and en // this localization might not work for every language but is fine for de and en
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_schemes_prefix"), size); bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_schemes_prefix"), size);
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
@ -1250,14 +1253,14 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
rnl(F); rnl(F);
for (e = edges; e; e = e->next) { for (e = edges; e; e = e->next) {
bool first = true; bool first = true;
message *msg; message *msg;
bufp = buf; bufp = buf;
size = sizeof(buf) - 1; size = sizeof(buf) - 1;
for (d = 0; d != MAXDIRECTIONS; ++d) { for (d = 0; d != MAXDIRECTIONS; ++d) {
if (!e->exist[d]) if (!e->exist[d])
continue; continue;
// this localization might not work for every language but is fine for de and en // this localization might not work for every language but is fine for de and en
if (first) if (first)
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_borderlist_prefix"), size); bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_borderlist_prefix"), size);
else if (e->lastd == d) else if (e->lastd == d)
@ -1271,12 +1274,13 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
first = false; first = false;
} }
// TODO name is localized? Works for roads anyway... // TODO name is localized? Works for roads anyway...
msg = msg_message("nr_borderlist_postfix", "transparent object", e->transparent, e->name); msg = msg_message("nr_borderlist_postfix", "transparent object",
bytes = (int)nr_render(msg, f->locale, bufp, size, f); e->transparent, e->name);
msg_release(msg); bytes = (int)nr_render(msg, f->locale, bufp, size, f);
if (wrptr(&bufp, &size, bytes) != 0) msg_release(msg);
WARN_STATIC_BUFFER(); if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
*bufp = 0; *bufp = 0;
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
@ -1416,18 +1420,18 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
++counter; ++counter;
if (u->ship != NULL) { if (u->ship != NULL) {
#ifdef GERMAN_FLUFF_ENABLED #ifdef GERMAN_FLUFF_ENABLED
if (strcmp("de", f->locale->name)==0) { if (strcmp("de", f->locale->name)==0) {
if (counter == 1) { if (counter == 1) {
bytes = (int)strlcpy(bufp, "Die ", size); bytes = (int)strlcpy(bufp, "Die ", size);
} }
else { else {
bytes = (int)strlcpy(bufp, "die ", size); bytes = (int)strlcpy(bufp, "die ", size);
} }
if (wrptr(&bufp, &size, bytes) != 0) { if (wrptr(&bufp, &size, bytes) != 0) {
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
break; break;
} }
} }
#endif #endif
bytes = (int)strlcpy(bufp, shipname(u->ship), size); bytes = (int)strlcpy(bufp, shipname(u->ship), size);
} }
@ -2019,11 +2023,12 @@ const faction * f)
} }
if (b->besieged > 0 && sr->mode >= see_lighthouse) { if (b->besieged > 0 && sr->mode >= see_lighthouse) {
msg = msg_message("nr_building_besieged", "soldiers diff", b->besieged, b->besieged - b->size * SIEGEFACTOR); msg = msg_message("nr_building_besieged", "soldiers diff", b->besieged,
bytes = (int)nr_render(msg, f->locale, bufp, size, f); b->besieged - b->size * SIEGEFACTOR);
if (wrptr(&bufp, &size, bytes) != 0) bytes = (int)nr_render(msg, f->locale, bufp, size, f);
WARN_STATIC_BUFFER(); if (wrptr(&bufp, &size, bytes) != 0)
msg_release(msg); WARN_STATIC_BUFFER();
msg_release(msg);
} }
i = 0; i = 0;
if (b->display && b->display[0]) { if (b->display && b->display[0]) {
@ -2562,21 +2567,21 @@ static void update_find(void)
if (initial) if (initial)
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
unit *u; unit *u;
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
faction *lastf = u->faction; faction *lastf = u->faction;
unit *u2; unit *u2;
for (u2 = r->units; u2; u2 = u2->next) { for (u2 = r->units; u2; u2 = u2->next) {
if (u2->faction == lastf || u2->faction == u->faction) if (u2->faction == lastf || u2->faction == u->faction)
continue; continue;
if (seefaction(u->faction, r, u2, 0)) { if (seefaction(u->faction, r, u2, 0)) {
faction *fv = visible_faction(u->faction, u2); faction *fv = visible_faction(u->faction, u2);
lastf = fv; lastf = fv;
add_find(u->faction, u2, fv); add_find(u->faction, u2, fv);
}
} }
} }
} }
}
initial = false; initial = false;
} }