Merge branch 'master' into develop

This commit is contained in:
Enno Rehling 2020-05-24 16:14:38 +02:00
commit 085115c4e4
1 changed files with 34 additions and 34 deletions

View File

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