Merge pull request #907 from ennorehling/master

bug 2666 english creport is broken
This commit is contained in:
Enno Rehling 2020-05-24 15:58:29 +02:00 committed by GitHub
commit 5cf5e2751a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 34 deletions

View File

@ -769,7 +769,6 @@ static void cr_output_spells(stream *out, const unit * u, int maxlevel)
void cr_output_unit(stream *out, const faction * f,
const unit * u, seen_mode mode)
{
const struct locale *lang = crtag_locale();
/* Race attributes are always plural and item attributes always
* singular */
const char *str;
@ -782,6 +781,7 @@ void cr_output_unit(stream *out, const faction * f,
const faction *fother;
const char *prefix;
bool allied;
const struct locale *lang = f->locale;
assert(u && u->number);
@ -841,16 +841,17 @@ void cr_output_unit(stream *out, const faction * f,
pzTmp = get_racename(u->attribs);
if (pzTmp) {
const char *pzRace = pzTmp;
const struct race *rc = rc_find(pzTmp);
if (rc) {
pzRace = rc_name_s(rc, NAME_PLURAL);
const char *pzRace = locale_string(lang, mkname("race", pzTmp), false);
if (pzRace) {
pzTmp = pzRace;
}
pzTmp = translate(pzRace, locale_string(lang, pzRace, false));
stream_printf(out, "\"%s\";Typ\n", pzTmp);
rc = u_race(u);
if (u->faction == f && fval(rc, RCF_SHAPESHIFTANY)) {
pzRace = rc_name_s(rc, NAME_PLURAL);
pzRace = translate(pzTmp, locale_string(lang, pzTmp, false));
if (!pzRace) {
pzRace = pzTmp;
}
stream_printf(out, "\"%s\";Typ\n", pzRace);
if (u->faction == f && fval(u_race(u), RCF_SHAPESHIFTANY)) {
pzRace = rc_name_s(u_race(u), NAME_PLURAL);
stream_printf(out, "\"%s\";wahrerTyp\n", pzRace);
}
}
@ -1558,7 +1559,7 @@ static void report_itemtype(FILE *F, faction *f, const item_type *itype) {
static int
report_computer(const char *filename, report_context * ctx, const char *bom)
{
const struct locale *lang = crtag_locale();
static int era = -1;
int i;
faction *f = ctx->f;
const char *prefix, *str;
@ -1568,7 +1569,6 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
FILE *F = fopen(filename, "w");
static const race *rc_human;
static int rc_cache;
static int era = -1;
if (era < 0) {
era = config_get_int("game.era", 1);
@ -1623,13 +1623,13 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
}
{
const char *zRace = rc_name_s(f->race, NAME_PLURAL);
fprintf(F, "\"%s\";Typ\n", translate(zRace, LOC(lang, zRace)));
fprintf(F, "\"%s\";Typ\n", translate(zRace, LOC(f->locale, zRace)));
}
prefix = get_prefix(f->attribs);
if (prefix != NULL) {
prefix = mkname("prefix", prefix);
fprintf(F, "\"%s\";typprefix\n",
translate(prefix, LOC(lang, prefix)));
translate(prefix, LOC(f->locale, prefix)));
}
fprintf(F, "%d;Rekrutierungskosten\n", f->race->recruitcost);
fprintf(F, "%d;Anzahl Personen\n", f->num_people);
@ -1682,7 +1682,7 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
if (prefix != NULL) {
prefix = mkname("prefix", prefix);
fprintf(F, "\"%s\";typprefix\n",
translate(prefix, LOC(lang, prefix)));
translate(prefix, LOC(f->locale, prefix)));
}
show_allies_cr(F, f, g);
}
@ -1752,25 +1752,25 @@ int crwritemap(const char *filename)
void register_cr(void)
{
tsf_register("report", &cr_ignore);
tsf_register("string", &cr_string);
tsf_register("order", &cr_order);
tsf_register("spell", &cr_spell);
tsf_register("curse", &cr_curse);
tsf_register("int", &cr_int);
tsf_register("unit", &cr_unit);
tsf_register("region", &cr_region);
tsf_register("faction", &cr_faction);
tsf_register("ship", &cr_ship);
tsf_register("building", &cr_building);
tsf_register("skill", &cr_skill);
tsf_register("resource", &cr_resource);
tsf_register("race", &cr_race);
tsf_register("direction", &cr_int);
tsf_register("alliance", &cr_alliance);
tsf_register("resources", &cr_resources);
tsf_register("items", &cr_resources);
tsf_register("regions", &cr_regions);
tsf_register("report", cr_ignore);
tsf_register("string", cr_string);
tsf_register("order", cr_order);
tsf_register("spell", cr_spell);
tsf_register("curse", cr_curse);
tsf_register("int", cr_int);
tsf_register("unit", cr_unit);
tsf_register("region", cr_region);
tsf_register("faction", cr_faction);
tsf_register("ship", cr_ship);
tsf_register("building", cr_building);
tsf_register("skill", cr_skill);
tsf_register("resource", cr_resource);
tsf_register("race", cr_race);
tsf_register("direction", cr_int);
tsf_register("alliance", cr_alliance);
tsf_register("resources", cr_resources);
tsf_register("items", cr_resources);
tsf_register("regions", cr_regions);
if (!nocr)
register_reporttype("cr", &report_computer, 1 << O_COMPUTER);