From 59745c7ed0ff44c6cc47502511159240c50d6765 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 3 Jul 2015 16:13:24 +0200 Subject: [PATCH 1/3] parentheses to fix operator precedence. --- src/kernel/config.c | 2 +- src/kernel/unit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index d298f77d7..eb5c9064b 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -530,7 +530,7 @@ int alliedunit(const unit * u, const faction * f2, int mode) ally *sf; int automode; - assert(u->region); /* the unit should be in a region, but it's possible that u->number==0 (TEMP units) */ + assert(u && u->region); /* the unit should be in a region, but it's possible that u->number==0 (TEMP units) */ if (u->faction == f2) return mode; if (u->faction != NULL && f2 != NULL) { diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 6a0e22f08..a43ae2153 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1281,7 +1281,7 @@ static int update_gbdream(const unit * u, int bonus, curse *c, const curse_type /* wir suchen jeweils den groessten Bonus und den groestsen Malus */ if (sign * effect > sign * bonus) { if (mage == NULL || mage->number == 0 - || sign>0?alliedunit(mage, u->faction, HELP_GUARD):!alliedunit(mage, u->faction, HELP_GUARD)) { + || (sign>0?alliedunit(mage, u->faction, HELP_GUARD):!alliedunit(mage, u->faction, HELP_GUARD))) { bonus = (int)effect; } } From c42227c9e491f24c6e53b56ac375863441562673 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 3 Jul 2015 17:36:37 +0200 Subject: [PATCH 2/3] 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/3] 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; }