From 979f3460d64c833cf4f6a23b4de8be96af5394e1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 3 Jul 2015 15:31:57 +0200 Subject: [PATCH 1/9] Bug 1805: re-enable NMR warnings https://bugs.eressea.de/view.php?id=1805 move warnings to the top of the list of errors in the NR --- res/core/de/strings.xml | 6 ----- res/core/en/strings.xml | 4 ---- res/core/fr/strings.xml | 3 --- res/core/messages.xml | 13 ++++++++--- src/laws.c | 51 ++++++++++++++++++++++++++++++++--------- src/reports.c | 34 --------------------------- 6 files changed, 50 insertions(+), 61 deletions(-) diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml index 351a7e376..aa5b94309 100644 --- a/res/core/de/strings.xml +++ b/res/core/de/strings.xml @@ -2212,12 +2212,6 @@ Schaden - - - Deine Partei hat letzte Runde keinen Zug - abgegeben! - - Schneemann diff --git a/res/core/en/strings.xml b/res/core/en/strings.xml index e68915f06..d80c742b9 100644 --- a/res/core/en/strings.xml +++ b/res/core/en/strings.xml @@ -1660,10 +1660,6 @@ - - No orders were received for your faction! - - Mistelzweig diff --git a/res/core/fr/strings.xml b/res/core/fr/strings.xml index 0fe39c99b..8acc1d89f 100644 --- a/res/core/fr/strings.xml +++ b/res/core/fr/strings.xml @@ -2051,7 +2051,4 @@ côte ouest - - Aucun ordre reçu pour votre faction ! - diff --git a/res/core/messages.xml b/res/core/messages.xml index 0afc458c2..6e6b0c8aa 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -7100,9 +7100,16 @@ "$unit($unit) in $region($region): '$order($command)' - Your faction must be at least $int($turns) weeks old to give something to another faction." - - - + + + Deine Partei hat letzte Runde keinen Zug + abgegeben! + No orders were received for your faction! + Aucun ordre reçu pour votre faction ! + + + + "Bitte sende die Befehle nächste Runde ein, wenn du weiterspielen möchtest." "Please send in orders for the next turn if you want to continue playing." diff --git a/src/laws.c b/src/laws.c index 2854b2cc8..e5d9392f3 100755 --- a/src/laws.c +++ b/src/laws.c @@ -125,16 +125,6 @@ static int RemoveNMRNewbie(void) return value; } -static void checkorders(void) -{ - faction *f; - - log_info(" - Warne spaete Spieler..."); - for (f = factions; f; f = f->next) - if (!is_monsters(f) && turn - f->lastorders == NMRTimeout() - 1) - ADDMSG(&f->msgs, msg_message("turnreminder", "")); -} - static void age_unit(region * r, unit * u) { if (u_race(u) == get_race(RC_SPELL)) { @@ -735,6 +725,45 @@ void immigration(void) } } +static void nmr_warnings(void) +{ + faction *f, *fa; +#define FRIEND (HELP_GUARD|HELP_MONEY) + for (f = factions; f; f = f->next) { + if (!fval(f, FFL_NOIDLEOUT) && turn > f->lastorders) { + ADDMSG(&f->msgs, msg_message("nmr_warning", "")); + if (turn - f->lastorders == NMRTimeout() - 1) { + ADDMSG(&f->msgs, msg_message("nmr_warning_final", "")); + } + if ((turn - f->lastorders) >= 2) { + message *msg = NULL; + for (fa = factions; fa; fa = fa->next) { + int warn = 0; + if (get_param_int(global.parameters, "rules.alliances", 0) != 0) { + if (f->alliance && f->alliance == fa->alliance) { + warn = 1; + } + } + else if (alliedfaction(NULL, f, fa, FRIEND) + && alliedfaction(NULL, fa, f, FRIEND)) { + warn = 1; + } + if (warn) { + if (msg == NULL) { + msg = + msg_message("warn_dropout", "faction turns", f, + turn - f->lastorders); + } + add_message(&fa->msgs, msg); + } + } + if (msg != NULL) + msg_release(msg); + } + } + } +} + void demographics(void) { region *r; @@ -810,7 +839,6 @@ void demographics(void) remove_empty_units(); immigration(); - checkorders(); } /* ------------------------------------------------------------- */ @@ -4367,6 +4395,7 @@ void init_processor(void) } p = 10; + add_proc_global(p, nmr_warnings, "NMR Warnings"); add_proc_global(p, new_units, "Neue Einheiten erschaffen"); p += 10; diff --git a/src/reports.c b/src/reports.c index 51ce2c53b..128815f71 100644 --- a/src/reports.c +++ b/src/reports.c @@ -1834,39 +1834,6 @@ int write_reports(faction * f, time_t ltime) return 0; } -static void nmr_warnings(void) -{ - faction *f, *fa; -#define FRIEND (HELP_GUARD|HELP_MONEY) - for (f = factions; f; f = f->next) { - if (!fval(f, FFL_NOIDLEOUT) && (turn - f->lastorders) >= 2) { - message *msg = NULL; - for (fa = factions; fa; fa = fa->next) { - int warn = 0; - if (get_param_int(global.parameters, "rules.alliances", 0) != 0) { - if (f->alliance && f->alliance == fa->alliance) { - warn = 1; - } - } - else if (alliedfaction(NULL, f, fa, FRIEND) - && alliedfaction(NULL, fa, f, FRIEND)) { - warn = 1; - } - if (warn) { - if (msg == NULL) { - msg = - msg_message("warn_dropout", "faction turns", f, - turn - f->lastorders); - } - add_message(&fa->msgs, msg); - } - } - if (msg != NULL) - msg_release(msg); - } - } -} - static void report_donations(void) { region *r; @@ -1945,7 +1912,6 @@ int reports(void) if (verbosity >= 1) { log_printf(stdout, "Writing reports for turn %d:", turn); } - nmr_warnings(); report_donations(); remove_empty_units(); From c42227c9e491f24c6e53b56ac375863441562673 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 3 Jul 2015 17:36:37 +0200 Subject: [PATCH 2/9] Bug 1838: Giftwolken dauern nur eine Woche, erscheinen nicht im Report. https://bugs.eressea.de/view.php?id=1838 - fix dc_age return value - speed up curse reporting a little --- src/creport.c | 6 +++++- src/kernel/curse.c | 3 --- src/util/attrib.h | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/creport.c b/src/creport.c index 59fa60ecb..f309c2d1c 100644 --- a/src/creport.c +++ b/src/creport.c @@ -264,6 +264,7 @@ cr_output_curses(FILE * F, const faction * viewer, const void *obj, objtype_t ty fprintf(F, "\"%s\"\n", buf); msg_release(msg); } + a = a->next; } else if (a->type == &at_effect && self) { effect_data *data = (effect_data *)a->data.v; @@ -276,8 +277,11 @@ cr_output_curses(FILE * F, const faction * viewer, const void *obj, objtype_t ty fprintf(F, "\"%d %s\"\n", data->value, translate(key, LOC(default_locale, key))); } + a = a->next; + } + else { + a = a->nexttype; } - a = a->next; } } diff --git a/src/kernel/curse.c b/src/kernel/curse.c index 0cad2dfa6..2709c7ac0 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -513,12 +513,9 @@ static curse *make_curse(unit * mage, attrib ** ap, const curse_type * ct, break; case CURSETYP_UNIT: - { c->data.i = men; break; } - - } return c; } diff --git a/src/util/attrib.h b/src/util/attrib.h index 11bc92bd1..38055331f 100644 --- a/src/util/attrib.h +++ b/src/util/attrib.h @@ -90,8 +90,8 @@ extern "C" { #define AT_READ_OK 0 #define AT_READ_FAIL -1 -#define AT_AGE_REMOVE 0 /* remove the attribute after calling age() */ -#define AT_AGE_KEEP 1 /* keep the attribute for another turn */ +#define AT_AGE_KEEP 0 /* keep the attribute for another turn */ +#define AT_AGE_REMOVE 1 /* remove the attribute after calling age() */ #ifdef __cplusplus } From af004bb27b9c23aac0f96980220577fde90db482 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 3 Jul 2015 18:27:10 +0200 Subject: [PATCH 3/9] individual poison damage messages --- res/core/messages.xml | 20 +++++++++++++++++++- src/spells.c | 5 +++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/res/core/messages.xml b/res/core/messages.xml index 0afc458c2..71a870475 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -1182,7 +1182,25 @@ "$unit($unit) drowns in $region($region)." - + + + + + + "$unit($unit) nimmt Schaden durch den Giftelementar in $region($region)." + "$unit($unit) is taking poison damage in $region($region)." + + + + + + + + "$unit($unit) stirbt am Schaden durch den Giftelementar in $region($region)." + "$unit($unit) dies from poison damage taken in $region($region)." + + + diff --git a/src/spells.c b/src/spells.c index 401f0ac9e..b7e1e6868 100644 --- a/src/spells.c +++ b/src/spells.c @@ -2820,9 +2820,9 @@ static int dc_age(struct curse *c) if (curse_active(c)) while (*up != NULL) { unit *u = *up; + int hp; double damage = c->effect * u->number; - freset(u->faction, FFL_SELECT); if (u->number <= 0 || target_resists_magic(mage, u, TYP_UNIT, 0)) { up = &u->next; continue; @@ -2830,8 +2830,9 @@ static int dc_age(struct curse *c) /* Reduziert durch Magieresistenz */ damage *= (1.0 - magic_resistance(u)); - change_hitpoints(u, -(int)damage); + hp = change_hitpoints(u, -(int)damage); + ADDMSG(&u->faction->msgs, msg_message((hp>0)?"poison_damage":"poison_death", "region unit", r, u)); if (*up == u) up = &u->next; } From 1e9e3a3b6ae01707da2b9a7b8703366f5f0179a9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 4 Jul 2015 17:54:00 +0200 Subject: [PATCH 4/9] Bug 1596: Schwer verwundete fliehen auch nach der Taktik-Runde. https://bugs.eressea.de/view.php?id=1596 remove an unnecessary (and wrong) check. --- src/battle.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/battle.c b/src/battle.c index 9608a382e..f97c39a2a 100644 --- a/src/battle.c +++ b/src/battle.c @@ -4206,8 +4206,6 @@ static void battle_flee(battle * b) default: if ((fig->person[dt.index].flags & FL_HIT) == 0) continue; - if (b->turn <= 1) - continue; if (fig->person[dt.index].hp <= runhp) break; if (fig->person[dt.index].flags & FL_PANICED) { From ae8c448698b0a86a4eee00a973f222b3a2f8b9bf Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 5 Jul 2015 14:07:59 +0200 Subject: [PATCH 5/9] do not remove new players for missing their first turn. --- conf/e2/config.xml | 2 +- src/laws.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/e2/config.xml b/conf/e2/config.xml index 435bd5005..0ff1d67ee 100644 --- a/conf/e2/config.xml +++ b/conf/e2/config.xml @@ -90,7 +90,7 @@ - + diff --git a/src/laws.c b/src/laws.c index 2854b2cc8..068e6033b 100755 --- a/src/laws.c +++ b/src/laws.c @@ -113,7 +113,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* - exported global symbols ----------------------------------- */ -static int RemoveNMRNewbie(void) +static bool RemoveNMRNewbie(void) { static int value = -1; static int gamecookie = -1; @@ -122,7 +122,7 @@ static int RemoveNMRNewbie(void) value = get_param_int(global.parameters, "nmr.removenewbie", 0); gamecookie = global.cookie; } - return value; + return value!=0; } static void checkorders(void) From 03a8c6a89f1a8df73f05bcb4d6dc6c68ac80e35a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 4 Jul 2015 23:42:41 +0200 Subject: [PATCH 6/9] avoid monsters: only seed new factions in hexes that have no units nearby. --- scripts/populate.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/populate.lua b/scripts/populate.lua index dfd07b5dd..5df2ad92f 100644 --- a/scripts/populate.lua +++ b/scripts/populate.lua @@ -6,7 +6,7 @@ local function score(r, res) local x, y, rn local peas = r:get_resource(res) for _, rn in pairs(r.adj) do - if rn then + if rn and not rn.units() then peas = peas + rn:get_resource(res) end end @@ -16,7 +16,7 @@ end local function select(regions, limit) local sel = {} for r in regions do - if r.terrain~="ocean" and r.units()==nil then + if r.terrain~="ocean" and not r.units() then s = score(r) if s >= limit then table.insert(sel, r) From 89ea0b994649b36d66b40089fdfdad466cca7ab2 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 5 Jul 2015 14:16:17 +0200 Subject: [PATCH 7/9] simplify test setup: as long as all games have nmr.removenewbie set to off by their config, no test should need to disable it. --- scripts/tests/common.lua | 2 -- scripts/tests/e2/guard.lua | 1 - scripts/tests/e2/movement.lua | 1 - scripts/tests/e2/shiplanding.lua | 1 - scripts/tests/e3/spells.lua | 1 - scripts/tests/movement.lua | 1 - scripts/tests/orders.lua | 1 - scripts/tests/pool.lua | 1 - 8 files changed, 9 deletions(-) diff --git a/scripts/tests/common.lua b/scripts/tests/common.lua index b4800761f..fb1a29965 100644 --- a/scripts/tests/common.lua +++ b/scripts/tests/common.lua @@ -26,7 +26,6 @@ module("tests.common", package.seeall, lunit.testcase) function setup() eressea.free_game() - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("NewbieImmunity", "0") eressea.settings.set("rules.economy.food", "4") @@ -961,7 +960,6 @@ module("tests.report", package.seeall, lunit.testcase) function setup() eressea.free_game() - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("rules.economy.food", "4") end diff --git a/scripts/tests/e2/guard.lua b/scripts/tests/e2/guard.lua index 1afd011e9..b1c9d9c4f 100644 --- a/scripts/tests/e2/guard.lua +++ b/scripts/tests/e2/guard.lua @@ -4,7 +4,6 @@ module("tests.e2.guard", package.seeall, lunit.testcase) function setup() eressea.free_game() - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("NewbieImmunity", "0") eressea.settings.set("rules.economy.food", "4") diff --git a/scripts/tests/e2/movement.lua b/scripts/tests/e2/movement.lua index ef62873d8..7e20e41ca 100644 --- a/scripts/tests/e2/movement.lua +++ b/scripts/tests/e2/movement.lua @@ -4,7 +4,6 @@ module("tests.e2.movement", package.seeall, lunit.testcase) function setup() eressea.free_game() - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("NewbieImmunity", "0") end diff --git a/scripts/tests/e2/shiplanding.lua b/scripts/tests/e2/shiplanding.lua index 2d9225b8d..a46a7da37 100644 --- a/scripts/tests/e2/shiplanding.lua +++ b/scripts/tests/e2/shiplanding.lua @@ -4,7 +4,6 @@ module("tests.e2.shiplanding", package.seeall, lunit.testcase) function setup() eressea.free_game() - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("NewbieImmunity", "0") end diff --git a/scripts/tests/e3/spells.lua b/scripts/tests/e3/spells.lua index 7afe96d8e..c4f0aadaf 100644 --- a/scripts/tests/e3/spells.lua +++ b/scripts/tests/e3/spells.lua @@ -5,7 +5,6 @@ module("tests.e3.spells", package.seeall, lunit.testcase) function setup() eressea.game.reset() eressea.settings.set("magic.fumble.enable", "0") - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("rules.peasants.growth", "0") end diff --git a/scripts/tests/movement.lua b/scripts/tests/movement.lua index e27831cc8..110b5b2a2 100644 --- a/scripts/tests/movement.lua +++ b/scripts/tests/movement.lua @@ -4,7 +4,6 @@ module("tests.movement", package.seeall, lunit.testcase) function setup() eressea.free_game() - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("rules.ships.storms", "0") conf = [[{ diff --git a/scripts/tests/orders.lua b/scripts/tests/orders.lua index 98115f644..d9443c9c4 100644 --- a/scripts/tests/orders.lua +++ b/scripts/tests/orders.lua @@ -16,7 +16,6 @@ function setup() u = _G.unit.create(f, r, 1) u:clear_orders() eressea.settings.set("rules.economy.food", "4") - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("NewbieImmunity", "0") end diff --git a/scripts/tests/pool.lua b/scripts/tests/pool.lua index 3ee3d54db..bf32eda87 100644 --- a/scripts/tests/pool.lua +++ b/scripts/tests/pool.lua @@ -6,7 +6,6 @@ function setup() eressea.game.reset() eressea.config.reset() eressea.settings.set("rules.economy.food", "0") - eressea.settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.timeout", "0") eressea.settings.set("rules.magic.playerschools", "") conf = [[{ From 960e0f8024a39b3f1b59b8194d6407ae587b42f3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 6 Jul 2015 16:13:22 +0200 Subject: [PATCH 8/9] do not show magic resistance effects to other than the unit's own faction. https://bugs.eressea.de/view.php?id=1692 --- res/core/messages.xml | 1 + src/spells/unitcurse.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/res/core/messages.xml b/res/core/messages.xml index 0afc458c2..1f8baae33 100644 --- a/res/core/messages.xml +++ b/res/core/messages.xml @@ -392,6 +392,7 @@ + "Die natürliche Widerstandskraft gegen Verzauberung ist gestärkt. ($int36($id))" diff --git a/src/spells/unitcurse.c b/src/spells/unitcurse.c index bd332ebf5..80ebe56bb 100644 --- a/src/spells/unitcurse.c +++ b/src/spells/unitcurse.c @@ -302,7 +302,7 @@ static struct curse_type ct_oldrace = { }; static struct curse_type ct_magicresistance = { - "magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple + "magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_unit }; /* ------------------------------------------------------------- */ From b36c1c76f882c5a0e587eb1d9141162967a0be77 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 7 Jul 2015 15:32:24 +0200 Subject: [PATCH 9/9] send signals from travis to slack --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index da3381bdc..69ad7d2e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,3 +9,6 @@ before_install: os: - linux - osx +notifications: + slack: + secure: F89aXLWaE125PaJIlETv12jT4EfH6wLXJmGCPZzrN3OcLn2ahDWqjwuzR7lOEDf2nAISmeMPyDZMhEHXLNHAE5qP6lg9yliYQw5hzGmDK9m1xUq/pPEne/b2Y7K3my1mkRZ6n3asbHgSmBWAfCIk1JN8R5Rv+rmbLuWLc+zofts=