From aa66e5d39f3f78f73a7e84ef961e2f65029172b3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 22 Jan 2017 19:06:37 +0100 Subject: [PATCH 1/5] remove unused equipment sets (from an unrealized feature). --- res/e3a/equipment.xml | 69 ------------------------------------------- 1 file changed, 69 deletions(-) diff --git a/res/e3a/equipment.xml b/res/e3a/equipment.xml index bbd2ac5b7..9fe133f48 100644 --- a/res/e3a/equipment.xml +++ b/res/e3a/equipment.xml @@ -1,78 +1,9 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 94fcef2fac2146cb19b30a4fdd8bbc73d3be8d05 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 22 Jan 2017 19:32:03 +0100 Subject: [PATCH 2/5] the locales module is deprecated. let's do this in custom.lua from now on. --- scripts/eressea/e2/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/eressea/e2/init.lua b/scripts/eressea/e2/init.lua index ed996c395..722078741 100644 --- a/scripts/eressea/e2/init.lua +++ b/scripts/eressea/e2/init.lua @@ -11,7 +11,7 @@ return { require('eressea.tunnels'), require('eressea.ponnuki'), require('eressea.astral'), - require('eressea.locales'), +-- require('eressea.locales'), require('eressea.jsreport'), require('eressea.ents'), require('eressea.cursed') From 9ccaab6516cbec55f6bff76fcce2be586994ff5d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 22 Jan 2017 20:19:32 +0100 Subject: [PATCH 3/5] Korrekte Email-Subject und Adresse, auch im NR. Eliminate crufty per-game strings. --- conf/e2/config.xml | 12 ------------ conf/e3/config.xml | 12 ------------ conf/e4/config.xml | 12 ------------ res/core/de/strings.xml | 6 ++++++ res/core/messages.xml | 10 ++++++++++ src/creport.c | 4 +--- src/kernel/config.c | 17 +++++++++++++++-- src/kernel/config.h | 1 + src/kernel/config.test.c | 2 ++ src/report.c | 17 +++++++++++------ src/reports.c | 7 +++++++ src/reports.h | 1 + 12 files changed, 54 insertions(+), 47 deletions(-) diff --git a/conf/e2/config.xml b/conf/e2/config.xml index 8389ba470..56c622d04 100644 --- a/conf/e2/config.xml +++ b/conf/e2/config.xml @@ -52,16 +52,4 @@ - - - Bitte denke daran, deine Befehle mit dem Betreff - ERESSEA 2 BEFEHLE an eressea-server@eressea.kn-bremen.de zu senden. - Remember to send your orders to - eressea-server@eressea.kn-bremen.de with the subject ERESSEA 2 ORDERS. - - - ERESSEA 2 BEFEHLE - ERESSEA 2 ORDERS - - diff --git a/conf/e3/config.xml b/conf/e3/config.xml index 35716f332..ac05d5a5a 100644 --- a/conf/e3/config.xml +++ b/conf/e3/config.xml @@ -36,16 +36,4 @@ - - - Bitte denke daran, deine Befehle mit dem Betreff - ERESSEA 3 BEFEHLE an eressea-server@eressea.kn-bremen.de zu senden. - Remember to send your orders to - eressea-server@eressea.kn-bremen.de with the subject E3 ORDERS. - - - ERESSEA 3 BEFEHLE - ERESSEA 3 ORDERS - - diff --git a/conf/e4/config.xml b/conf/e4/config.xml index ac962202c..f9ede1a27 100644 --- a/conf/e4/config.xml +++ b/conf/e4/config.xml @@ -36,16 +36,4 @@ - - - Bitte denke daran, deine Befehle mit dem Betreff - ERESSEA 4 BEFEHLE an eressea-server@eressea.kn-bremen.de zu senden. - Remember to send your orders to - eressea-server@eressea.kn-bremen.de with the subject ERESSEA 4 ORDERS. - - - ERESSEA 4 BEFEHLE - ERESSEA 4 ORDERS - - diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index b23d44ffb..7d31fc678 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -6,6 +6,12 @@ _x: preposition (15 /Schlumpf/schwerter) _a: including article (ein Schlumpf, a smurf) --> + + + BEFEHLE + ORDERS + + Wirbel vortex diff --git a/res/core/messages.xml b/res/core/messages.xml index 130b58d03..6892ec4e5 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -1,5 +1,15 @@ + + + + + + Bitte denke daran, deine Befehle mit dem Betreff + $subject an $email zu senden. + Remember to send your orders to + $email with the subject ${subject}. + diff --git a/src/creport.c b/src/creport.c index 34cff9de3..e8e401190 100644 --- a/src/creport.c +++ b/src/creport.c @@ -1510,9 +1510,7 @@ report_computer(const char *filename, report_context * ctx, const char *bom) fprintf(F, "%d;Zeitalter\n", era); fprintf(F, "\"%s\";Build\n", eressea_version()); if (mailto != NULL) { - // char mailcmd[64]; - // snprintf(mailcmd, sizeof(mailcmd), "%s %d, %s", game_name(), game_id(), LOC(f->locale, "mailcmd")); - const char * mailcmd = LOC(f->locale, "mailcmd"); + const char * mailcmd = get_mailcmd(f->locale); fprintf(F, "\"%s\";mailto\n", mailto); fprintf(F, "\"%s\";mailcmd\n", mailcmd); } diff --git a/src/kernel/config.c b/src/kernel/config.c index 88130056b..80a78df36 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -803,12 +803,25 @@ void free_gamedata(void) } } -const char * game_name(void) { +const char * game_name(void) +{ const char * param = config_get("game.name"); return param ? param : global.gamename; } +const char * game_name_upper(void) +{ + static char result[32]; // FIXME: static result + char *r = result; + const char *param = game_name(); + const char *c = param; + while (*c && (r-result)age <= 2) { - const char *s; - s = locale_getstring(f->locale, "newbie_info_game"); - if (s) { - newline(out); - centre(out, s, true); + const char *email; + const char *subject; + email = config_get("game.email"); + subject = get_mailcmd(f->locale); + m = msg_message("newbie_info_game", "email subject", email, subject); + if (m) { + nr_render(m, f->locale, buf, sizeof(buf), f); + msg_release(m); + centre(out, buf, true); } if ((f->options & want(O_COMPUTER)) == 0) { - f->options |= want(O_COMPUTER); + const char *s; s = locale_getstring(f->locale, "newbie_info_cr"); if (s) { newline(out); centre(out, s, true); } + f->options |= want(O_COMPUTER); } } newline(out); diff --git a/src/reports.c b/src/reports.c index 0da8aed94..c6df944a3 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1945,6 +1945,13 @@ static void eval_regions(struct opstack **stack, const void *userdata) opush(stack, var); } +const char *get_mailcmd(const struct locale *loc) +{ + static char result[64]; // FIXME: static return buffer + snprintf(result, sizeof(result), "%s %d %s", game_name_upper(), game_id(), LOC(loc, "mailcmd")); + return result; +} + static void eval_trail(struct opstack **stack, const void *userdata) { /* order -> string */ const faction *report = (const faction *)userdata; diff --git a/src/reports.h b/src/reports.h index 99dd7ebf6..cc197bed4 100644 --- a/src/reports.h +++ b/src/reports.h @@ -129,6 +129,7 @@ extern "C" { int stream_printf(struct stream * out, const char *format, ...); int count_travelthru(struct region *r, const struct faction *f); + const char *get_mailcmd(const struct locale *loc); #define GR_PLURAL 0x01 /* grammar: plural */ #define MAX_INVENTORY 128 /* maimum number of different items in an inventory */ From 30665f874a23f2c02b89096d27a3a58e21061839 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 22 Jan 2017 20:32:54 +0100 Subject: [PATCH 4/5] fix game_name, remove it from rules --- conf/e2/config.json | 2 -- conf/e3/config.json | 2 -- conf/e4/config.json | 2 -- res/core/de/strings.xml | 2 -- src/kernel/config.c | 2 +- 5 files changed, 1 insertion(+), 9 deletions(-) diff --git a/conf/e2/config.json b/conf/e2/config.json index ce823a33d..ca157f501 100644 --- a/conf/e2/config.json +++ b/conf/e2/config.json @@ -8,8 +8,6 @@ "jsreport" ], "settings": { - "game.id": 2, - "game.name": "Eressea", "orders.default": "work", "NewbieImmunity": 8, "modules.wormholes": true, diff --git a/conf/e3/config.json b/conf/e3/config.json index 30bc7e599..fd533070e 100644 --- a/conf/e3/config.json +++ b/conf/e3/config.json @@ -25,8 +25,6 @@ "jsreport" ], "settings": { - "game.id": 3, - "game.name": "E3", "orders.default": "work", "database.gameid": 7, "NewbieImmunity": 4, diff --git a/conf/e4/config.json b/conf/e4/config.json index cbe273af6..91961258a 100644 --- a/conf/e4/config.json +++ b/conf/e4/config.json @@ -25,8 +25,6 @@ "jsreport" ], "settings": { - "game.id": 4, - "game.name": "Deveron", "orders.default": "work", "database.gameid": 7, "NewbieImmunity": 4, diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index 7d31fc678..bccfdd165 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -6,12 +6,10 @@ _x: preposition (15 /Schlumpf/schwerter) _a: including article (ein Schlumpf, a smurf) --> - BEFEHLE ORDERS - Wirbel vortex diff --git a/src/kernel/config.c b/src/kernel/config.c index 80a78df36..403c80050 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -815,7 +815,7 @@ const char * game_name_upper(void) char *r = result; const char *param = game_name(); const char *c = param; - while (*c && (r-result)r) { *r++ = (char)toupper(*c++); } *r = '\0'; From 3a07d43321c12958d4d4a73cbfe11de3054aa18f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 22 Jan 2017 21:02:15 +0100 Subject: [PATCH 5/5] specify a game id, because there is one in the data --- tests/eressea.ini | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/eressea.ini b/tests/eressea.ini index e84171d45..faf4b1b9e 100644 --- a/tests/eressea.ini +++ b/tests/eressea.ini @@ -1,10 +1,8 @@ -[eressea] -base = . -report = reports +[game] +name = Eressea +id = 2 +email = eressea-server@kn-bremen.de verbose = 0 -lomem = 0 -debug = 0 -memcheck = 0 locales = de,en [lua]