From 3a76261302fce9723f23e601a99acbe81f98364e Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 24 May 2020 15:39:13 +0200 Subject: [PATCH 1/2] bug 2666 english creport is broken --- src/creport.c | 68 +++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/creport.c b/src/creport.c index ddfe1247c..d6383168d 100644 --- a/src/creport.c +++ b/src/creport.c @@ -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); From fe35ca06044278721321305d8ed33049a357b460 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 15 Mar 2020 14:32:37 +0100 Subject: [PATCH 2/2] reduce cron messages --- process/sendreports.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/process/sendreports.sh b/process/sendreports.sh index c56233367..3219a69ea 100755 --- a/process/sendreports.sh +++ b/process/sendreports.sh @@ -17,8 +17,8 @@ fi cd "$GAME/reports" || exit for REPORT in *.sh do - echo -n "Sending " - basename "$REPORT" .sh + #echo -n "Sending " + #basename "$REPORT" .sh bash "$REPORT" done cd - || exit