Unicode WIP:

- NR is being written
- NR and Template get a UTF8 BOM

I'm running out of ideas. I must be nearly ready.
This commit is contained in:
Enno Rehling 2007-08-19 17:30:40 +00:00
parent 28921d4e3d
commit 8fbb513b63
11 changed files with 258 additions and 337 deletions

View file

@ -1190,21 +1190,21 @@ ally_cmd(unit * u, struct order * ord)
sf->status = sf->status | HELP_TRAVEL; sf->status = sf->status | HELP_TRAVEL;
break; break;
case P_GIB: case P_GIVE:
if (not_kw == P_NOT) if (not_kw == P_NOT)
sf->status = sf->status & (HELP_ALL - HELP_GIVE); sf->status = sf->status & (HELP_ALL - HELP_GIVE);
else else
sf->status = sf->status | HELP_GIVE; sf->status = sf->status | HELP_GIVE;
break; break;
case P_SILVER: case P_MONEY:
if (not_kw == P_NOT) if (not_kw == P_NOT)
sf->status = sf->status & (HELP_ALL - HELP_MONEY); sf->status = sf->status & (HELP_ALL - HELP_MONEY);
else else
sf->status = sf->status | HELP_MONEY; sf->status = sf->status | HELP_MONEY;
break; break;
case P_KAEMPFE: case P_FIGHT:
if (not_kw == P_NOT) if (not_kw == P_NOT)
sf->status = sf->status & (HELP_ALL - HELP_FIGHT); sf->status = sf->status & (HELP_ALL - HELP_FIGHT);
else else

View file

@ -47,6 +47,7 @@
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/karma.h> #include <kernel/karma.h>
#include <kernel/message.h> #include <kernel/message.h>
#include <kernel/move.h>
#include <kernel/objtypes.h> #include <kernel/objtypes.h>
#include <kernel/order.h> #include <kernel/order.h>
#include <kernel/plane.h> #include <kernel/plane.h>
@ -76,6 +77,8 @@
#include <util/nrmessage.h> #include <util/nrmessage.h>
#include <util/rng.h> #include <util/rng.h>
#include <libxml/encoding.h>
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
@ -222,6 +225,7 @@ report_spell(FILE * F, spell *sp, const struct locale * lang)
{ {
int k, itemanz, costtyp; int k, itemanz, costtyp;
int dh = 0; int dh = 0;
char buf[4096];
char * bufp; char * bufp;
rnl(F); rnl(F);
@ -231,16 +235,16 @@ report_spell(FILE * F, spell *sp, const struct locale * lang)
rparagraph(F, spell_info(sp, lang), 2, 0, 0); rparagraph(F, spell_info(sp, lang), 2, 0, 0);
bufp = buf; bufp = buf;
bufp += strxcpy(bufp, LOC(lang, "nr_spell_type")); bufp += strlcpy(bufp, LOC(lang, "nr_spell_type"), sizeof(buf)-(bufp-buf));
*bufp++ = ' '; *bufp++ = ' ';
if (sp->sptyp & PRECOMBATSPELL) { if (sp->sptyp & PRECOMBATSPELL) {
bufp += strxcpy(bufp, "Präkampfzauber"); bufp += strlcpy(bufp, LOC(lang, "sptype_precombat"), sizeof(buf)-(bufp-buf));
} else if (sp->sptyp & COMBATSPELL) { } else if (sp->sptyp & COMBATSPELL) {
bufp += strxcpy(bufp, "Kampfzauber"); bufp += strlcpy(bufp, LOC(lang, "sptype_combat"), sizeof(buf)-(bufp-buf));
} else if (sp->sptyp & POSTCOMBATSPELL) { } else if (sp->sptyp & POSTCOMBATSPELL) {
bufp += strxcpy(bufp, "Postkampfzauber"); bufp += strlcpy(bufp, LOC(lang, "sptype_postcombat"), sizeof(buf)-(bufp-buf));
} else { } else {
bufp += strxcpy(bufp, "Normaler Zauber"); bufp += strlcpy(bufp, LOC(lang, "sptype_normal"), sizeof(buf)-(bufp-buf));
} }
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
@ -259,7 +263,7 @@ report_spell(FILE * F, spell *sp, const struct locale * lang)
if (sp->sptyp & SPELLLEVEL) { if (sp->sptyp & SPELLLEVEL) {
bufp = buf + sprintf(buf, " %d %s", itemanz, LOC(lang, resourcename(rtype, itemanz!=1))); bufp = buf + sprintf(buf, " %d %s", itemanz, LOC(lang, resourcename(rtype, itemanz!=1)));
if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR ) { if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR ) {
bufp += strxcpy(bufp, " * Stufe"); bufp += sprintf(bufp, " * %s", LOC(lang, "nr_level"));
} }
} else { } else {
if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR ) { if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR ) {
@ -271,35 +275,35 @@ report_spell(FILE * F, spell *sp, const struct locale * lang)
} }
} }
bufp = buf + strxcpy(buf, LOC(lang, "nr_spell_modifiers")); bufp = buf + strlcpy(buf, LOC(lang, "nr_spell_modifiers"), sizeof(buf)-(bufp-buf));
if (sp->sptyp & FARCASTING) { if (sp->sptyp & FARCASTING) {
bufp += strxcpy(bufp, " Fernzauber"); bufp += strlcpy(bufp, " Fernzauber", sizeof(buf)-(bufp-buf));
dh = 1; dh = 1;
} }
if (sp->sptyp & OCEANCASTABLE) { if (sp->sptyp & OCEANCASTABLE) {
if (dh == 1) { if (dh == 1) {
bufp += strxcpy(bufp, ","); bufp += strlcpy(bufp, ",", sizeof(buf)-(bufp-buf));
} }
bufp += strxcpy(bufp, " Seezauber"); bufp += strlcpy(bufp, " Seezauber", sizeof(buf)-(bufp-buf));
dh = 1; dh = 1;
} }
if (sp->sptyp & ONSHIPCAST) { if (sp->sptyp & ONSHIPCAST) {
if (dh == 1){ if (dh == 1){
bufp += strxcpy(bufp, ","); bufp += strlcpy(bufp, ",", sizeof(buf)-(bufp-buf));
} }
bufp += strxcpy(bufp, " Schiffszauber"); bufp += strlcpy(bufp, " Schiffszauber", sizeof(buf)-(bufp-buf));
dh = 1; dh = 1;
} }
if (sp->sptyp & NOTFAMILIARCAST) { if (sp->sptyp & NOTFAMILIARCAST) {
if (dh == 1){ if (dh == 1){
bufp += strxcpy(bufp, ", k"); bufp += strlcpy(bufp, ", k", sizeof(buf)-(bufp-buf));
} else { } else {
bufp += strxcpy(bufp, " K"); bufp += strlcpy(bufp, " K", sizeof(buf)-(bufp-buf));
} }
bufp += strxcpy(bufp, "ann nicht vom Vertrauten gezaubert werden"); bufp += strlcpy(bufp, "ann nicht vom Vertrauten gezaubert werden", sizeof(buf)-(bufp-buf));
dh = 1; dh = 1;
} }
if (dh == 0) bufp += strxcpy(bufp, " Keine"); if (dh == 0) bufp += strlcpy(bufp, " Keine", sizeof(buf)-(bufp-buf));
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
rparagraph(F, LOC(lang, "nr_spell_syntax"), 0, 0, 0); rparagraph(F, LOC(lang, "nr_spell_syntax"), 0, 0, 0);
@ -325,7 +329,7 @@ report_spell(FILE * F, spell *sp, const struct locale * lang)
} else if (sp->sptyp & SHIPSPELL) { } else if (sp->sptyp & SHIPSPELL) {
bufp += strxcpy(bufp, "<Schiff-Nr>"); bufp += strxcpy(bufp, "<Schiff-Nr>");
} else if (sp->sptyp & BUILDINGSPELL) { } else if (sp->sptyp & BUILDINGSPELL) {
bufp += strxcpy(bufp, "<Gebäude-Nr>"); bufp += strxcpy(bufp, "<Gebaeude-Nr>");
} }
} else { } else {
if (sp->sptyp & UNITSPELL) { if (sp->sptyp & UNITSPELL) {
@ -333,7 +337,7 @@ report_spell(FILE * F, spell *sp, const struct locale * lang)
} else if (sp->sptyp & SHIPSPELL) { } else if (sp->sptyp & SHIPSPELL) {
bufp += strxcpy(bufp, "<Schiff-Nr> [<Schiff-Nr> ...]"); bufp += strxcpy(bufp, "<Schiff-Nr> [<Schiff-Nr> ...]");
} else if (sp->sptyp & BUILDINGSPELL) { } else if (sp->sptyp & BUILDINGSPELL) {
bufp += strxcpy(bufp, "<Gebäude-Nr> [<Gebäude-Nr> ...]"); bufp += strxcpy(bufp, "<Gebaeude-Nr> [<Gebaeude-Nr> ...]");
} }
} }
rparagraph(F, buf, 2, 0, 0); rparagraph(F, buf, 2, 0, 0);
@ -369,7 +373,7 @@ sparagraph(strlist ** SP, const char *s, int indent, char mark)
/* j zeigt auf das ende der aktuellen zeile, i zeigt auf den anfang der /* j zeigt auf das ende der aktuellen zeile, i zeigt auf den anfang der
* nächsten zeile. existiert ein wort am anfang der zeile, welches * nächsten zeile. existiert ein wort am anfang der zeile, welches
* länger als eine zeile ist, muß dieses hier abgetrennt werden. */ * länger als eine zeile ist, muss dieses hier abgetrennt werden. */
if (i == 0) if (i == 0)
i = width - 1; i = width - 1;
@ -474,7 +478,8 @@ print_curses(FILE *F, const faction *viewer, const void * obj, typ_t typ, int in
/* fehler */ /* fehler */
} }
for(;a;a=a->next) { for (;a;a=a->next) {
char buf[4096];
if (fval(a->type, ATF_CURSE)) { if (fval(a->type, ATF_CURSE)) {
curse *c = (curse *)a->data.v; curse *c = (curse *)a->data.v;
@ -534,12 +539,13 @@ 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);
char buf[8192];
if (u->race == new_race[RC_SPELL]) return; if (u->race == new_race[RC_SPELL]) return;
{ {
rnl(F); rnl(F);
dh = bufunit(f, u, indent, mode); dh = bufunit(f, u, indent, mode, buf, sizeof(buf));
} }
a_otherfaction = a_find(u->attribs, &at_otherfaction); a_otherfaction = a_find(u->attribs, &at_otherfaction);
@ -608,7 +614,8 @@ rp_battles(FILE * F, faction * f)
rnl(F); rnl(F);
while (bm) { while (bm) {
RENDER(f, buf, 80, ("battle::header", "region", bm->r)); char buf[80];
RENDER(f, buf, sizeof(buf), ("battle::header", "region", bm->r));
rnl(F); rnl(F);
centre(F, buf, true); centre(F, buf, true);
rnl(F); rnl(F);
@ -625,6 +632,7 @@ prices(FILE * F, const region * r, const faction * f)
struct demand * dmd; struct demand * dmd;
message * m; message * m;
int n = 0; int n = 0;
char buf[4096];
if (r->land==NULL || r->land->demands==NULL) return; if (r->land==NULL || r->land->demands==NULL) return;
for (dmd=r->land->demands;dmd;dmd=dmd->next) { for (dmd=r->land->demands;dmd;dmd=dmd->next) {
@ -640,27 +648,26 @@ prices(FILE * F, const region * r, const faction * f)
if (n > 0) { if (n > 0) {
char * bufp = buf + strlen(buf); char * bufp = buf + strlen(buf);
bufp += strxcpy(bufp, " "); bufp += strlcpy(bufp, " ", sizeof(buf)-(bufp-buf));
bufp += strxcpy(bufp, LOC(f->locale, "nr_trade_intro")); bufp += strlcpy(bufp, LOC(f->locale, "nr_trade_intro"), sizeof(buf)-(bufp-buf));
bufp += strxcpy(bufp, " "); bufp += strlcpy(bufp, " ", sizeof(buf)-(bufp-buf));
for (dmd=r->land->demands;dmd;dmd=dmd->next) if(dmd->value > 0) { for (dmd=r->land->demands;dmd;dmd=dmd->next) 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);
nr_render(m, f->locale, bufp, sizeof(buf)-(bufp-buf), f); bufp += nr_render(m, f->locale, bufp, sizeof(buf)-(bufp-buf), f);
msg_release(m); msg_release(m);
n--; n--;
bufp += strlen(bufp);
if (n == 0) { if (n == 0) {
bufp += strxcpy(bufp, LOC(f->locale, "nr_trade_end")); bufp += strlcpy(bufp, LOC(f->locale, "nr_trade_end"), sizeof(buf)-(bufp-buf));
} }
else if (n == 1) { else if (n == 1) {
strcpy(bufp++, " "); bufp += strlcpy(bufp, " ", sizeof(buf)-(bufp-buf));
bufp += strxcpy(bufp, LOC(f->locale, "nr_trade_final")); bufp += strlcpy(bufp, LOC(f->locale, "nr_trade_final"), sizeof(buf)-(bufp-buf));
strcpy(bufp++, " "); bufp += strlcpy(bufp, " ", sizeof(buf)-(bufp-buf));
} else { } else {
bufp += strxcpy(bufp, LOC(f->locale, "nr_trade_next")); bufp += strlcpy(bufp, LOC(f->locale, "nr_trade_next"), sizeof(buf)-(bufp-buf));
strcpy(bufp++, " "); bufp += strlcpy(bufp, " ", sizeof(buf)-(bufp-buf));
} }
} }
} }
@ -708,6 +715,7 @@ describe(FILE * F, const region * r, int partial, faction * f)
direction_t lastd; direction_t lastd;
} * edges = NULL, * e; } * edges = NULL, * e;
boolean see[MAXDIRECTIONS]; boolean see[MAXDIRECTIONS];
char buf[8192];
char * bufp = buf; char * bufp = buf;
for (d = 0; d != MAXDIRECTIONS; d++) { for (d = 0; d != MAXDIRECTIONS; d++) {
@ -758,7 +766,7 @@ describe(FILE * F, const region * r, int partial, faction * f)
tname = terrain_name(r); tname = terrain_name(r);
bufp += strxcpy(bufp, LOC(f->locale, tname)); bufp += strxcpy(bufp, LOC(f->locale, tname));
/* Bäume */ /* Trees */
trees = rtrees(r,2); trees = rtrees(r,2);
saplings = rtrees(r,1); saplings = rtrees(r,1);
@ -858,59 +866,56 @@ describe(FILE * F, const region * r, int partial, faction * f)
} }
} }
if (!is_cursed(r->attribs, C_REGCONF, 0)) { a = a_find(r->attribs, &at_overrideroads);
attrib *a_do = a_find(r->attribs, &at_overrideroads); if (a) {
if(a_do) { strcpy(bufp++, " ");
strcpy(bufp++, " "); bufp += strxcpy(bufp, (char *)a->data.v);
bufp += strxcpy(bufp, (char *)a_do->data.v); } else {
} else { int nrd = 0;
int nrd = 0;
/* Nachbarregionen, die gesehen werden, ermitteln */ /* Nachbarregionen, die gesehen werden, ermitteln */
for (d = 0; d != MAXDIRECTIONS; d++) for (d = 0; d != MAXDIRECTIONS; d++)
if (see[d] && rconnect(r, d)) nrd++; if (see[d] && rconnect(r, d)) nrd++;
/* Richtungen aufzählen */ /* list directions */
dh = false; dh = false;
for (d = 0; d != MAXDIRECTIONS; d++) if (see[d]) { for (d = 0; d != MAXDIRECTIONS; d++) if (see[d]) {
region * r2 = rconnect(r, d); region * r2 = rconnect(r, d);
if(!r2) continue; if(!r2) continue;
nrd--; nrd--;
if (dh) { if (dh) {
char regname[4096]; char regname[4096];
if (nrd == 0) { if (nrd == 0) {
strcpy(bufp++, " ");
bufp += strxcpy(bufp, LOC(f->locale, "nr_nb_final"));
} else {
bufp += strxcpy(bufp, LOC(f->locale, "nr_nb_next"));
}
bufp += strxcpy(bufp, LOC(f->locale, directions[d]));
strcpy(bufp++, " "); strcpy(bufp++, " ");
bufp += sprintf(bufp, trailinto(r2, f->locale), bufp += strxcpy(bufp, LOC(f->locale, "nr_nb_final"));
f_regionid(r2, f, regname, sizeof(regname))); } else {
bufp += strxcpy(bufp, LOC(f->locale, "nr_nb_next"));
} }
else { bufp += strxcpy(bufp, LOC(f->locale, directions[d]));
strcpy(bufp++, " ");
MSG(("nr_vicinitystart", "dir region", d, r2), bufp, sizeof(buf)-(bufp-buf), f->locale, f);
bufp += strlen(bufp);
dh = true;
}
}
/* Spezielle Richtungen */
for (a = a_find(r->attribs, &at_direction);a && a->type==&at_direction;a=a->next) {
spec_direction * d = (spec_direction *)(a->data.v);
strcpy(bufp++, " "); strcpy(bufp++, " ");
bufp += strxcpy(bufp, d->desc); f_regionid(r2, f, regname, sizeof(regname));
bufp += strxcpy(bufp, " (\""); bufp += sprintf(bufp, trailinto(r2, f->locale),
bufp += strxcpy(bufp, d->keyword); regname);
bufp += strxcpy(bufp, "\")"); }
strcpy(bufp++, "."); else {
dh = 1; strcpy(bufp++, " ");
MSG(("nr_vicinitystart", "dir region", d, r2), bufp, sizeof(buf)-(bufp-buf), f->locale, f);
bufp += strlen(bufp);
dh = true;
} }
} }
} else { /* Spezielle Richtungen */
bufp += strxcpy(bufp, " Große Verwirrung befällt alle Reisenden in dieser Region."); for (a = a_find(r->attribs, &at_direction);a && a->type==&at_direction;a=a->next) {
spec_direction * d = (spec_direction *)(a->data.v);
strcpy(bufp++, " ");
bufp += strxcpy(bufp, d->desc);
bufp += strxcpy(bufp, " (\"");
bufp += strxcpy(bufp, d->keyword);
bufp += strxcpy(bufp, "\")");
strcpy(bufp++, ".");
dh = 1;
}
} }
rnl(F); rnl(F);
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
@ -988,13 +993,12 @@ static void
statistics(FILE * F, const region * r, const faction * f) statistics(FILE * F, const region * r, const faction * f)
{ {
const unit *u; const unit *u;
int number, p; int number = 0, p = rpeasants(r);
message * m; message * m;
item *itm, *items = NULL; item *itm, *items = NULL;
p = rpeasants(r); char buf[4096];
number = 0;
/* zählen */ /* count */
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) {
@ -1003,7 +1007,7 @@ statistics(FILE * F, const region * r, const faction * f)
number += u->number; number += u->number;
} }
} }
/* Ausgabe */ /* print */
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);
@ -1043,7 +1047,7 @@ statistics(FILE * F, const region * r, const faction * f)
msg_release(m); msg_release(m);
} }
} }
/* Info über Einheiten */ /* info about units */
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);
@ -1065,9 +1069,10 @@ durchreisende(FILE * F, const region * r, const faction * f)
if (fval(r, RF_TRAVELUNIT)) { if (fval(r, RF_TRAVELUNIT)) {
attrib *abegin = a_find(r->attribs, &at_travelunit), *a; attrib *abegin = a_find(r->attribs, &at_travelunit), *a;
int counter = 0, maxtravel = 0; int counter = 0, maxtravel = 0;
char buf[8192];
char * str = buf; char * str = buf;
/* Wieviele sind aufzulisten? Für die Grammatik. */ /* How many are we listing? For grammar. */
for (a = abegin; a && a->type==&at_travelunit; a = a->next) { for (a = abegin; a && a->type==&at_travelunit; a = a->next) {
unit * u = (unit*)a->data.v; unit * u = (unit*)a->data.v;
@ -1094,27 +1099,27 @@ durchreisende(FILE * F, const region * r, const faction * f)
++counter; ++counter;
if (u->ship != NULL) { if (u->ship != NULL) {
if (counter == 1) { if (counter == 1) {
str += strxcpy(str, "Die "); str += strlcpy(str, "Die ", sizeof(buf)-(str-buf));
} else { } else {
str += strxcpy(str, "die "); str += strlcpy(str, "die ", sizeof(buf)-(str-buf));
} }
str += strxcpy(str, shipname(u->ship)); str += strlcpy(str, shipname(u->ship), sizeof(buf)-(str-buf));
} else { } else {
str += strxcpy(str, unitname(u)); str += strlcpy(str, unitname(u), sizeof(buf)-(str-buf));
} }
if (counter + 1 < maxtravel) { if (counter + 1 < maxtravel) {
str += strxcpy(str, ", "); str += strlcpy(str, ", ", sizeof(buf)-(str-buf));
} else if (counter + 1 == maxtravel) { } else if (counter + 1 == maxtravel) {
str += strxcpy(str, " und "); str += strlcpy(str, LOC(f->locale, "list_and"), sizeof(buf)-(str-buf));
} }
} }
} }
} }
if (maxtravel == 1) { if (maxtravel == 1) {
str += strxcpy(str, " hat die Region durchquert."); str += strlcpy(str, " hat die Region durchquert.", sizeof(buf)-(str-buf));
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
} else { } else {
str += strxcpy(str, " haben die Region durchquert."); str += strlcpy(str, " haben die Region durchquert.", sizeof(buf)-(str-buf));
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);
} }
} }
@ -1144,19 +1149,27 @@ buildingmaintenance(const building * b, const resource_type * rtype)
} }
static int static int
report_template(const char * filename, report_context * ctx) report_template(const char * filename, report_context * ctx, const char * charset)
{ {
faction * f = ctx->f; faction * f = ctx->f;
region *r; region *r;
plane *pl; plane *pl;
FILE * F = fopen(filename, "wt"); FILE * F = fopen(filename, "wt");
seen_region * sr = NULL; seen_region * sr = NULL;
char buf[8192];
char * bufp;
int enc = xmlParseCharEncoding(charset);
if (F==NULL) { if (F==NULL) {
perror(filename); perror(filename);
return -1; return -1;
} }
if (enc==XML_CHAR_ENCODING_UTF8) {
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
fwrite(utf8_bom, 1, 3, F);
}
rps_nowrap(F, ""); rps_nowrap(F, "");
rnl(F); rnl(F);
rps_nowrap(F, LOC(f->locale, "nr_template")); rps_nowrap(F, LOC(f->locale, "nr_template"));
@ -1213,31 +1226,26 @@ report_template(const char * filename, report_context * ctx)
} }
dh = 1; dh = 1;
sprintf(buf, "%s %s; %s [%d,%d$", LOC(u->faction->locale, parameters[P_UNIT]), bufp = buf + sprintf(buf, "%s %s; %s [%d,%d$", LOC(u->faction->locale, parameters[P_UNIT]),
unitid(u), u->name, u->number, get_money(u)); unitid(u), u->name, u->number, get_money(u));
if (u->building != NULL && fval(u, UFL_OWNER)) { if (u->building != NULL && fval(u, UFL_OWNER)) {
building * b = u->building; building * b = u->building;
int cost = buildingmaintenance(b, r_silver); int cost = buildingmaintenance(b, r_silver);
if (cost > 0) { if (cost > 0) {
scat(",U"); bufp += strlcpy(bufp, ",U", sizeof(buf)-(bufp-buf));
icat(cost); bufp += strlcpy(bufp, itoa10(cost), sizeof(buf)-(bufp-buf));
} }
#if TODO
if (buildingdaten[u->building->typ].spezial != 0) {
scat("+");
}
#endif
} else if (u->ship) { } else if (u->ship) {
if (fval(u, UFL_OWNER)) if (fval(u, UFL_OWNER))
scat(",S"); bufp += strlcpy(bufp, ",S", sizeof(buf)-(bufp-buf));
else else
scat(",s"); bufp += strlcpy(bufp, ",s", sizeof(buf)-(bufp-buf));
scat(shipid(u->ship)); bufp += strlcpy(bufp, shipid(u->ship), sizeof(buf)-(bufp-buf));
} }
if (lifestyle(u) == 0) if (lifestyle(u) == 0)
scat(",I"); bufp += strlcpy(bufp, ",I", sizeof(buf)-(bufp-buf));
scat("]"); bufp += strlcpy(bufp, "]", sizeof(buf)-(bufp-buf));
rps_nowrap(F, buf); rps_nowrap(F, buf);
rnl(F); rnl(F);
@ -1284,12 +1292,14 @@ report_template(const char * filename, report_context * ctx)
} }
static void static void
show_allies(const faction * f, const ally * allies) show_allies(FILE * F, const faction * f, const ally * allies, char * buf, size_t size)
{ {
int allierte = 0; int allierte = 0;
int i=0, h, hh = 0; int i=0, h, hh = 0;
int dh = 0; int dh = 0;
const ally * sf; const ally * sf;
char * bufp = buf + strlen(buf); /* buf already contains data */
for (sf = allies; sf; sf = sf->next) { for (sf = allies; sf; sf = sf->next) {
int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL); int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
if (mode > 0) ++allierte; if (mode > 0) ++allierte;
@ -1301,78 +1311,69 @@ show_allies(const faction * f, const ally * allies)
i++; i++;
if (dh) { if (dh) {
if (i == allierte) if (i == allierte)
scat(" und "); bufp += strlcpy(bufp, LOC(f->locale, "list_and"), size-(bufp-buf));
else else
scat(", "); bufp += strlcpy(bufp, ", ", size-(bufp-buf));
} }
dh = 1; dh = 1;
hh = 0; hh = 0;
scat(factionname(sf->faction)); bufp += strlcpy(bufp, factionname(sf->faction), size-(bufp-buf));
scat(" ("); bufp += strlcpy(bufp, " (", size-(bufp-buf));
if ((mode & HELP_ALL) == HELP_ALL) { if ((mode & HELP_ALL) == HELP_ALL) {
scat("Alles"); bufp += strlcpy(bufp, "Alles", size-(bufp-buf));
} else } else {
for (h = 1; h < HELP_ALL; h *= 2) { for (h = 1; h < HELP_ALL; h *= 2) {
if ((mode & h) == h) int p = MAXPARAMS;
if ((mode & h) == h) {
switch (h) { switch (h) {
case HELP_TRAVEL: case HELP_TRAVEL:
scat("Durchreise"); p = P_TRAVEL;
hh = 1;
break; break;
case HELP_MONEY: case HELP_MONEY:
scat("Silber"); p = P_MONEY;
hh = 1; hh = 1;
break; break;
case HELP_FIGHT: case HELP_FIGHT:
if (hh) p = P_FIGHT;
scat(", ");
scat("Kämpfe");
hh = 1;
break;
case HELP_OBSERVE:
if (hh)
scat(", ");
scat("Wahrnehmung");
hh = 1;
break; break;
case HELP_GIVE: case HELP_GIVE:
if (hh) p = P_GIVE;
scat(", ");
scat("Gib");
hh = 1;
break; break;
case HELP_GUARD: case HELP_GUARD:
if (hh) p = P_GUARD;
scat(", ");
scat("Bewache");
hh = 1;
break; break;
case HELP_FSTEALTH: case HELP_FSTEALTH:
if (hh) p = P_FACTIONSTEALTH;
scat(", ");
scat("Parteitarnung");
hh = 1;
break; break;
} }
}
if (p!=MAXPARAMS) {
if (hh) strlcpy(bufp, ", ", size-(bufp-buf));
bufp += strlcpy(bufp, parameters[p], size-(bufp-buf));
hh = 1;
}
} }
scat(")"); }
strlcpy(bufp, ")", size-(bufp-buf));
} }
strlcpy(bufp, ".", size-(bufp-buf));
rparagraph(F, buf, 0, 0, 0);
rnl(F);
} }
static void static void
allies(FILE * F, const faction * f) allies(FILE * F, const faction * f)
{ {
const group * g = f->groups; const group * g = f->groups;
char buf[8192];
if (f->allies) { if (f->allies) {
if (!f->allies->next) { if (!f->allies->next) {
strcpy(buf, "Wir helfen der Partei "); strcpy(buf, "Wir helfen der Partei ");
} else { } else {
strcpy(buf, "Wir helfen den Parteien "); strcpy(buf, "Wir helfen den Parteien ");
} }
show_allies(f, f->allies); show_allies(F, f, f->allies, buf, sizeof(buf));
scat(".");
rparagraph(F, buf, 0, 0, 0);
rnl(F);
} }
while (g) { while (g) {
@ -1382,10 +1383,7 @@ allies(FILE * F, const faction * f)
} else { } else {
sprintf(buf, "%s hilft den Parteien ", g->name); sprintf(buf, "%s hilft den Parteien ", g->name);
} }
show_allies(f, g->allies); show_allies(F, f, g->allies, buf, sizeof(buf));
scat(".");
rparagraph(F, buf, 0, 0, 0);
rnl(F);
} }
g = g->next; g = g->next;
} }
@ -1450,25 +1448,25 @@ guards(FILE * F, const region * r, const faction * see)
} }
if (nextguard || tarned) { if (nextguard || tarned) {
strcpy(buf, "Die Region wird von "); char buf[8192];
} else { char * bufp = buf;
return; bufp += strlcpy(bufp, "Die Region wird von ", sizeof(buf) - (bufp-buf));
}
for (i = 0; i!=nextguard+(tarned?1:0); ++i) { for (i = 0; i!=nextguard+(tarned?1:0); ++i) {
if (i!=0) { if (i!=0) {
if (i == nextguard-(tarned?0:1)) if (i == nextguard-(tarned?0:1))
scat(" und "); strlcpy(bufp, LOC(see->locale, "list_and"), sizeof(buf) - (bufp-buf));
else else
scat(", "); strlcpy(bufp, ", ", sizeof(buf) - (bufp-buf));
}
if (i<nextguard) strlcpy(bufp, factionname(guardians[i]), sizeof(buf) - (bufp-buf));
else strlcpy(bufp, "unbekannten Einheiten", sizeof(buf) - (bufp-buf));
} }
if (i<nextguard) scat(factionname(guardians[i])); strlcpy(bufp, " bewacht.", sizeof(buf) - (bufp-buf));
rnl(F);
else scat("unbekannten Einheiten"); rparagraph(F, buf, 0, 0, 0);
} }
scat(" bewacht.");
rnl(F);
rparagraph(F, buf, 0, 0, 0);
} }
static void static void
@ -1493,6 +1491,8 @@ list_address(FILE * F, const faction * uf, const faction_list * seenfactions)
while (flist!=NULL) { while (flist!=NULL) {
const faction * f = flist->data; const faction * f = flist->data;
if (f->no!=MONSTER_FACTION) { if (f->no!=MONSTER_FACTION) {
char buf[8192];
sprintf(buf, "%s: %s; %s", factionname(f), f->email, f->banner); sprintf(buf, "%s: %s; %s", factionname(f), f->email, f->banner);
rparagraph(F, buf, 4, 0, (char)(ALLIED(uf, f)?'+':'*')); rparagraph(F, buf, 4, 0, (char)(ALLIED(uf, f)?'+':'*'));
#ifdef SHORTPWDS #ifdef SHORTPWDS
@ -1524,12 +1524,13 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
const struct locale * lang = NULL; const struct locale * lang = NULL;
const building_type * type = b->type; const building_type * type = b->type;
static const struct building_type * bt_illusion; static const struct building_type * bt_illusion;
char buffer[8192];
char * bufp = buffer;
if (!bt_illusion) bt_illusion = bt_find("illusion"); if (!bt_illusion) bt_illusion = bt_find("illusion");
if (f) lang = f->locale; if (f) lang = f->locale;
sprintf(buf, "%s, %s %d, ", buildingname(b), LOC(f->locale, "nr_size"), bufp += snprintf(bufp, sizeof(buffer)-(bufp-buffer), "%s, %s %d, ", buildingname(b), LOC(f->locale, "nr_size"), b->size);
b->size);
if (b->type==bt_illusion) { if (b->type==bt_illusion) {
attrib * a = a_find(b->attribs, &at_icastle); attrib * a = a_find(b->attribs, &at_icastle);
@ -1538,7 +1539,7 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
} }
} }
bname = LOC(lang, buildingtype(type, b, b->size)); bname = LOC(lang, buildingtype(type, b, b->size));
strcat(buf, bname); bufp += strlcpy(bufp, bname, sizeof(buffer)-(bufp-buffer));
if (type!=b->type) { if (type!=b->type) {
unit * owner = buildingowner(r, b); unit * owner = buildingowner(r, b);
if (owner && owner->faction==f) { if (owner && owner->faction==f) {
@ -1546,28 +1547,26 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
char lbuf[32]; char lbuf[32];
bname = LOC(lang, buildingtype(b->type, b, b->size)); bname = LOC(lang, buildingtype(b->type, b, b->size));
sprintf(lbuf, " (%s)", bname); sprintf(lbuf, " (%s)", bname);
strcat(buf, lbuf); bufp += strlcpy(bufp, lbuf, sizeof(buffer)-(bufp-buffer));
} }
} }
if (b->size < type->maxsize) { if (b->size < type->maxsize) {
scat(" (im Bau)"); bufp += strlcpy(bufp, " (im Bau)", sizeof(buffer)-(bufp-buffer));
} }
if (b->besieged > 0 && mode>=see_lighthouse) { if (b->besieged > 0 && mode>=see_lighthouse) {
scat(", belagert von "); bufp += strlcpy(bufp, ", belagert von ", sizeof(buffer)-(bufp-buffer));
icat(b->besieged); bufp += strlcpy(bufp, itoa10(b->besieged), sizeof(buffer)-(bufp-buffer));
scat(" Personen "); bufp += strlcpy(bufp, " Personen ", sizeof(buffer)-(bufp-buffer));
if (b->besieged >= b->size * SIEGEFACTOR) { if (b->besieged >= b->size * SIEGEFACTOR) {
scat("(abgeschnitten)"); bufp += strlcpy(bufp, "(abgeschnitten)", sizeof(buffer)-(bufp-buffer));
} else {
scat("(unvollständig belagert)");
} }
} }
i = 0; i = 0;
if (b->display && b->display[0]) { if (b->display && b->display[0]) {
scat("; "); bufp += strlcpy(bufp, "; ", sizeof(buffer)-(bufp-buffer));
scat(b->display); bufp += strlcpy(bufp, b->display, sizeof(buffer)-(bufp-buffer));
i = b->display[strlen(b->display) - 1]; i = b->display[strlen(b->display) - 1];
} }
@ -1624,11 +1623,11 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
#else #else
if (i != '!' && i != '?' && i != '.') if (i != '!' && i != '?' && i != '.')
scat("."); bufp += strlcpy(bufp, ".", sizeof(buffer)-(bufp-buffer));
#endif #endif
rparagraph(F, buf, 2, 0, 0); rparagraph(F, buffer, 2, 0, 0);
if (mode<see_lighthouse) return; if (mode<see_lighthouse) return;
@ -1648,7 +1647,7 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
} }
int int
report_plaintext(const char * filename, report_context * ctx) report_plaintext(const char * filename, report_context * ctx, const char * charset)
{ {
int flag = 0; int flag = 0;
char ch; char ch;
@ -1667,11 +1666,18 @@ report_plaintext(const char * filename, report_context * ctx)
int wants_stats = (f->options & ix); int wants_stats = (f->options & ix);
FILE * F = fopen(filename, "wt"); FILE * F = fopen(filename, "wt");
seen_region * sr = NULL; seen_region * sr = NULL;
char buf[8192];
char * bufp;
int enc = xmlParseCharEncoding(charset);
if (F==NULL) { if (F==NULL) {
perror(filename); perror(filename);
return -1; return -1;
} }
if (enc==XML_CHAR_ENCODING_UTF8) {
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf };
fwrite(utf8_bom, 1, 3, F);
}
strftime(pzTime, 64, "%A, %d. %B %Y, %H:%M", localtime(&ctx->report_time)); strftime(pzTime, 64, "%A, %d. %B %Y, %H:%M", localtime(&ctx->report_time));
m = msg_message("nr_header_date", "game date", global.gamename, pzTime); m = msg_message("nr_header_date", "game date", global.gamename, pzTime);
@ -1779,47 +1785,28 @@ report_plaintext(const char * filename, report_context * ctx)
centre(F, buf, true); centre(F, buf, true);
} }
if (f->age > 1 && f->lastorders != turn) {
rnl(F);
if (turn - f->lastorders == 1) {
centre(F, LOC(f->locale, "nr_nmr"), true);
} else {
sprintf(buf,
"Deine Partei hat seit %d Runden keinen Zug abgegeben! Wenn du"
" drei Runden nacheinander keinen Zug abgibst, wird sie"
" automatisch gelöscht.",
turn - f->lastorders);
centre(F, buf, true);
}
rnl(F);
}
/* Insekten-Winter-Warnung */ /* Insekten-Winter-Warnung */
if(f->race == new_race[RC_INSECT]) { if (f->race == new_race[RC_INSECT]) {
static int thisseason = -1; static int thisseason = -1;
if (thisseason<0) thisseason = get_gamedate(turn+1, 0)->season; if (thisseason<0) thisseason = get_gamedate(turn+1, 0)->season;
if (thisseason == 0) { if (thisseason == 0) {
strcpy(buf, "Es ist Winter, und Insekten können nur in Wüsten oder mit " centre(F, LOC(f->locale, "nr_insectwinter"), true);
"Hilfe des Nestwärme-Tranks Personen rekrutieren.");
centre(F, buf, true);
rnl(F); rnl(F);
} else { } else {
static int nextseason = -1; static int nextseason = -1;
if (nextseason<0) nextseason = get_gamedate(turn+2, 0)->season; if (nextseason<0) nextseason = get_gamedate(turn+2, 0)->season;
if (nextseason == 0) { if (nextseason == 0) {
strcpy(buf, "Es ist Spätherbst, und diese Woche ist die letzte vor dem " centre(F, LOC(f->locale, "nr_insectfall"), true);
"Winter, in der Insekten rekrutieren können.");
centre(F, buf, true);
rnl(F); rnl(F);
} }
} }
} }
sprintf(buf, "%s:", LOC(f->locale, "nr_options")); bufp = buf + sprintf(buf, "%s:", LOC(f->locale, "nr_options"));
for (op = 0; op != MAXOPTIONS; op++) { for (op = 0; op != MAXOPTIONS; op++) {
if (f->options & want(op)) { if (f->options & want(op)) {
scat(" "); bufp += strlcpy(bufp, " ", sizeof(buf)-(bufp-buf));
scat(LOC(f->locale, options[op])); bufp += strlcpy(bufp, LOC(f->locale, options[op]), sizeof(buf)-(bufp-buf));
#ifdef AT_OPTION #ifdef AT_OPTION
if(op == O_NEWS) { if(op == O_NEWS) {
attrib *a = a_find(f->attribs, &at_option_news); attrib *a = a_find(f->attribs, &at_option_news);
@ -1829,15 +1816,15 @@ report_plaintext(const char * filename, report_context * ctx)
} else { } else {
int sec = a->data.i; int sec = a->data.i;
int i; int i;
scat("("); bufp += strlcpy(bufp, "(", sizeof(buf)-(bufp-buf));
for(i=1; sec != 0; i *= 2) { for(i=1; sec != 0; i *= 2) {
if(sec & i) { if(sec & i) {
icat(i); bufp += strlcpy(bufp, itoa10(i), sizeof(buf)-(bufp-buf));
sec = sec & ~i; sec = sec & ~i;
if(sec) scat(","); if (sec) bufp += strlcpy(bufp, ",", sizeof(buf)-(bufp-buf));
} }
} }
scat(")"); bufp += strlcpy(bufp, ")", sizeof(buf)-(bufp-buf));
} }
} }
#endif #endif
@ -1869,6 +1856,8 @@ report_plaintext(const char * filename, report_context * ctx)
requirement * m; requirement * m;
if (ptype!=NULL) { if (ptype!=NULL) {
const char * pname = resourcename(ptype->itype->rtype, 0); const char * pname = resourcename(ptype->itype->rtype, 0);
char * bufp;
m = ptype->itype->construction->materials; m = ptype->itype->construction->materials;
if (ch==0) { if (ch==0) {
rnl(F); rnl(F);
@ -1881,11 +1870,13 @@ report_plaintext(const char * filename, report_context * ctx)
sprintf(buf, "%s %d", LOC(f->locale, "nr_level"), ptype->level); sprintf(buf, "%s %d", LOC(f->locale, "nr_level"), ptype->level);
centre(F, buf, true); centre(F, buf, true);
rnl(F); rnl(F);
sprintf(buf, "%s: ", LOC(f->locale, "nr_herbsrequired"));
bufp = buf + sprintf(buf, "%s: ", LOC(f->locale, "nr_herbsrequired"));
while (m->number) { while (m->number) {
scat(LOC(f->locale, resourcename(m->rtype, 0))); bufp += strlcpy(bufp, resourcename(m->rtype, 0), sizeof(buf)-(bufp-buf));
++m; ++m;
if (m->number) scat(", "); if (m->number)
bufp += strlcpy(bufp, ", ", sizeof(buf)-(bufp-buf));
} }
centre(F, buf, true); centre(F, buf, true);
rnl(F); rnl(F);
@ -1998,37 +1989,37 @@ report_plaintext(const char * filename, report_context * ctx)
getshipweight(sh, &n, &p); getshipweight(sh, &n, &p);
n = (n+99) / 100; /* 1 Silber = 1 GE */ n = (n+99) / 100; /* 1 Silber = 1 GE */
sprintf(buf, "%s, %s, (%d/%d)", shipname(sh), bufp = buf + sprintf(buf, "%s, %s, (%d/%d)", shipname(sh),
LOC(f->locale, sh->type->name[0]), n, shipcapacity(sh) / 100); LOC(f->locale, sh->type->name[0]), n, shipcapacity(sh) / 100);
} else { } else {
sprintf(buf, "%s, %s", shipname(sh), LOC(f->locale, sh->type->name[0])); bufp = buf + sprintf(buf, "%s, %s", shipname(sh), LOC(f->locale, sh->type->name[0]));
} }
assert(sh->type->construction->improvement==NULL); /* sonst ist construction::size nicht ship_type::maxsize */ assert(sh->type->construction->improvement==NULL); /* sonst ist construction::size nicht ship_type::maxsize */
if (sh->size!=sh->type->construction->maxsize) { if (sh->size!=sh->type->construction->maxsize) {
sprintf(buf+strlen(buf), ", %s (%d/%d)", bufp += sprintf(bufp, ", %s (%d/%d)",
LOC(f->locale, "nr_undercons"), sh->size, LOC(f->locale, "nr_undercons"), sh->size,
sh->type->construction->maxsize); sh->type->construction->maxsize);
} }
if (sh->damage) { if (sh->damage) {
int percent = (sh->damage*100+DAMAGE_SCALE-1)/(sh->size*DAMAGE_SCALE); int percent = (sh->damage*100+DAMAGE_SCALE-1)/(sh->size*DAMAGE_SCALE);
sprintf(buf+strlen(buf), ", %d%% %s", percent, LOC(f->locale, "nr_damaged")); bufp += sprintf(bufp, ", %d%% %s", percent, LOC(f->locale, "nr_damaged"));
} }
if (!fval(r->terrain, SEA_REGION)) { if (!fval(r->terrain, SEA_REGION)) {
if (sh->coast != NODIRECTION) { if (sh->coast != NODIRECTION) {
scat(", "); bufp += strlcpy(bufp, ", ", sizeof(buf) - (bufp-buf));
scat(LOC(f->locale, coasts[sh->coast])); bufp += strlcpy(bufp, LOC(f->locale, coasts[sh->coast]), sizeof(buf) - (bufp-buf));
} }
} }
ch = 0; ch = 0;
if (sh->display && sh->display[0]) { if (sh->display && sh->display[0]) {
scat("; "); bufp += strlcpy(bufp, "; ", sizeof(buf) - (bufp-buf));
scat(sh->display); bufp += strlcpy(bufp, sh->display, sizeof(buf) - (bufp-buf));
ch = sh->display[strlen(sh->display) - 1]; ch = sh->display[strlen(sh->display) - 1];
} }
if (ch != '!' && ch != '?' && ch != '.') if (ch != '!' && ch != '?' && ch != '.')
scat("."); bufp += strlcpy(bufp, ".", sizeof(buf) - (bufp-buf));
rparagraph(F, buf, 2, 0, 0); rparagraph(F, buf, 2, 0, 0);
@ -2173,87 +2164,6 @@ kann_finden(faction * f1, faction * f2)
return (boolean)(can_find(f1, f2)!=NULL); return (boolean)(can_find(f1, f2)!=NULL);
} }
static void
writemonument(void)
{
FILE * F;
region *r;
building *b;
building *buildings[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
int size[7] = {0,0,0,0,0,0,0};
int i, j, ra;
int count = 0;
unit *owner;
for (r = regions; r; r = r->next) {
for (b = r->buildings; b; b = b->next) {
if (b->type == bt_find("monument") && b->display && *b->display) {
freset(b, BLD_SELECT);
count++;
if(b->size > size[6]) {
for(i=0; i <= 6; i++) if(b->size >= size[i]) {
for(j=5;j >= i; j--) {
size[j+1] = size[j];
buildings[j+1] = buildings[j];
}
buildings[i] = b;
size[i] = b->size;
break;
}
}
}
}
}
for(i=0; i <= 6; i++) if(buildings[i]) {
fset(buildings[i], BLD_SELECT);
}
{
char zText[MAX_PATH];
sprintf(zText, "%s/news-monument", basepath());
F = cfopen(zText, "w");
if (!F) return;
}
fprintf(F, "\n--- maintitle ---\n\n");
for(i = 0; i<=6; i++) {
if (buildings[i] != NULL) {
fprintf(F, "In %s", rname(buildings[i]->region, NULL));
if ((owner=buildingowner(buildings[i]->region,buildings[i]))!=NULL && !fval(owner,UFL_PARTEITARNUNG)) {
fprintf(F, ", Eigentümer: %s", factionname(owner->faction));
}
fprintf(F, "\n\n");
report_building(F, buildings[i]->region, buildings[i], findfaction(0), see_neighbour);
fprintf(F, "\n\n");
}
}
fprintf(F, "\n--- newcomer ---\n\n");
if(count > 7) {
ra = rng_int()%(count-7);
j = 0;
for (r = regions; r; r = r->next) {
for (b = r->buildings; b; b = b->next) {
if (b->type == bt_find("monument") && b->display && *b->display && !fval(b, BLD_SELECT)) {
j++;
if(j == ra) {
fprintf(F, "In %s", rname(b->region, NULL));
if ((owner=buildingowner(b->region,b))!=NULL && !fval(owner,UFL_PARTEITARNUNG)) {
fprintf(F, ", Eigentümer: %s", factionname(owner->faction));
}
fprintf(F, "\n\n");
report_building(F, b->region, b, findfaction(0), see_neighbour);
fprintf(F, "\n\n");
}
}
}
}
}
fclose(F);
}
/******* end summary ******/ /******* end summary ******/
void void

View file

@ -123,7 +123,6 @@ ally_flag(const char * s)
{ {
if (strcmp(s, "money")==0) return HELP_MONEY; if (strcmp(s, "money")==0) return HELP_MONEY;
if (strcmp(s, "fight")==0) return HELP_FIGHT; if (strcmp(s, "fight")==0) return HELP_FIGHT;
if (strcmp(s, "observe")==0) return HELP_OBSERVE;
if (strcmp(s, "give")==0) return HELP_GIVE; if (strcmp(s, "give")==0) return HELP_GIVE;
if (strcmp(s, "guard")==0) return HELP_GUARD; if (strcmp(s, "guard")==0) return HELP_GUARD;
if (strcmp(s, "stealth")==0) return HELP_FSTEALTH; if (strcmp(s, "stealth")==0) return HELP_FSTEALTH;

View file

@ -119,24 +119,6 @@ extern const char *options[MAXOPTIONS];
extern int shipspeed(const struct ship * sh, const struct unit * u); extern int shipspeed(const struct ship * sh, const struct unit * u);
extern int init_data(const char * filename); extern int init_data(const char * filename);
#define DONT_HELP 0
#define HELP_MONEY 1 /* Mitversorgen von Einheiten */
#define HELP_FIGHT 2 /* Bei Verteidigung mithelfen */
#define HELP_OBSERVE 4 /* Bei Wahrnehmung mithelfen */
#define HELP_GIVE 8 /* Dinge annehmen ohne KONTAKTIERE */
#define HELP_GUARD 16 /* Laesst Steuern eintreiben etc. */
#define HELP_FSTEALTH 32 /* Parteitarnung anzeigen. */
#define HELP_TRAVEL 64 /* Laesst Regionen betreten. */
#define HELP_ALL (127-HELP_TRAVEL-HELP_OBSERVE) /* Alle "positiven" HELPs zusammen */
/* HELP_OBSERVE deaktiviert */
/* ------------------------------------------------------------- */
/* Prototypen */
#define ALLIED_TAX 1
#define ALLIED_NOBLOCK 2
#define ALLIED_HELP 4
#define i2b(i) ((boolean)((i)?(true):(false))) #define i2b(i) ((boolean)((i)?(true):(false)))
typedef struct ally { typedef struct ally {

View file

@ -381,7 +381,7 @@ sacrifice_cmd(unit * u, struct order * ord)
s = getstrtoken(); s = getstrtoken();
switch(findparam(s, u->faction->locale)) { switch(findparam(s, u->faction->locale)) {
case P_SILVER: case P_MONEY:
n = use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, n); n = use_pooled(u, oldresourcetype[R_SILVER], GET_DEFAULT, n);
if(n < 10000) { if(n < 10000) {
cmistake(u, ord, 51, MSG_EVENT); cmistake(u, ord, 51, MSG_EVENT);

View file

@ -681,6 +681,9 @@ bufunit(const faction * f, const unit * u, int indent, int mode, char * buf, siz
dh = 1; dh = 1;
} }
} }
if (size<=1) {
log_warning(("bufunit ran out of space after writing %u bytes.\n", (bufp-buf)));
}
return dh; return dh;
} }
@ -1421,7 +1424,7 @@ init_reports(void)
#ifdef HAVE_STAT #ifdef HAVE_STAT
{ {
struct stat st; stat_type st;
if (stat(reportpath(), &st)==0) return 0; if (stat(reportpath(), &st)==0) return 0;
} }
#endif #endif

View file

@ -178,13 +178,13 @@ enum {
P_PERSON, P_PERSON,
P_REGION, P_REGION,
P_SHIP, P_SHIP,
P_SILVER, P_MONEY,
P_ROAD, P_ROAD,
P_TEMP, P_TEMP,
P_FLEE, P_FLEE,
P_GEBAEUDE, P_GEBAEUDE,
P_GIB, P_GIVE,
P_KAEMPFE, P_FIGHT,
P_TRAVEL, P_TRAVEL,
P_GUARD, P_GUARD,
P_ZAUBER, P_ZAUBER,

View file

@ -89,7 +89,7 @@ getbuf_latin1(FILE * F)
++bp; ++bp;
continue; continue;
} }
if (c=='"' || c=='\'') { if (!comment && (c=='"' || c=='\'')) {
if (quote==c) { if (quote==c) {
quote = 0; quote = 0;
if (cp<fbuf+MAXLINE) *cp++ = *bp; if (cp<fbuf+MAXLINE) *cp++ = *bp;

View file

@ -61,9 +61,7 @@
#include <gamecode/items.h> #include <gamecode/items.h>
#include <gamecode/laws.h> #include <gamecode/laws.h>
#include <gamecode/creport.h> #include <gamecode/creport.h>
#ifdef REPORT_FORMAT_NR
#include <gamecode/report.h> #include <gamecode/report.h>
#endif
#include <gamecode/xmlreport.h> #include <gamecode/xmlreport.h>
/* kernel includes */ /* kernel includes */
@ -213,9 +211,7 @@ game_init(void)
init_xmas(); init_xmas();
reports_init(); reports_init();
#ifdef REPORT_FORMAT_NR
report_init(); report_init();
#endif
creport_init(); creport_init();
xmlreport_init(); xmlreport_init();

View file

@ -7399,8 +7399,37 @@
</string> </string>
<string name="attack_structural"> <string name="attack_structural">
<text locale="de">ein Angriff, der GEbäudeschaden verursacht</text> <text locale="de">ein Angriff, der Gebäudeschaden verursacht</text>
<text locale="en">an attack causing structural damage to buildings</text> <text locale="en">an attack causing structural damage to buildings</text>
</string> </string>
<string name="sptype_precombat">
<text locale="de">Präkampfzauber</text>
</string>
<string name="sptype_postcombat">
<text locale="de">Postkampfzauber</text>
</string>
<string name="sptype_combat">
<text locale="de">Kampfzauber</text>
</string>
<string name="sptype_normal">
<text locale="de">Normaler Zauber</text>
</string>
<string name="nr_insectwinter">
<text locale="de">Es ist Winter, und Insekten können nur in Wüsten oder mit Hilfe des Nestwärme-Tranks Personen rekrutieren.</text>
</string>
<string name="nr_insectfall">
<text locale="de">Es ist Spätherbst, und diese Woche ist die letzte vor dem Winter, in der Insekten rekrutieren können.</text>
</string>
<string name="nr_owner">
<text locale="de">Eigentümer</text>
<text locale="en">Owner</text>
</string>
</strings> </strings>

View file

@ -7098,6 +7098,7 @@
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - Your faction must be at least $int($turns) weeks old to give something to another faction."</text> <text locale="fr">"$unit($unit) in $region($region): '$order($command)' - Your faction must be at least $int($turns) weeks old to give something to another faction."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Your faction must be at least $int($turns) weeks old to give something to another faction."</text> <text locale="en">"$unit($unit) in $region($region): '$order($command)' - Your faction must be at least $int($turns) weeks old to give something to another faction."</text>
</message> </message>
<message name="turnreminder" section="errors"> <message name="turnreminder" section="errors">
<type> <type>
</type> </type>
@ -7105,6 +7106,7 @@
<text locale="fr">"Merci d'envoyer vos ordres pour le tour suivant si vous désirez continuer à jouer."</text> <text locale="fr">"Merci d'envoyer vos ordres pour le tour suivant si vous désirez continuer à jouer."</text>
<text locale="en">"Please send in orders for the next turn if you want to continue playing."</text> <text locale="en">"Please send in orders for the next turn if you want to continue playing."</text>
</message> </message>
<message name="newbieimmunity" section="events"> <message name="newbieimmunity" section="events">
<type> <type>
<arg name="turns" type="int"/> <arg name="turns" type="int"/>