diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index e2cf54dbf..330be3f69 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -152,6 +152,25 @@ static armor_type armordata[AR_NONE + 1] = { 0.00, 0.00, 0, 0, I_SWORD} }; +#ifndef NDEBUG +static void +validate_sides(battle * b) +{ + side* s; + cv_foreach(s, b->sides) { + int snumber = 0; + fighter *df; + cv_foreach(df, s->fighters) { + unit *du = df->unit; + snumber += du->number; + } cv_next(df); + assert(snumber==s->flee+s->healed+s->alive+s->dead); + } cv_next(s); +} +#else +#define validate_sides(b) /**/ +#endif + const troop no_troop = {0, 0}; region * @@ -2368,6 +2387,7 @@ aftermath(battle * b) /* Alle Fighter durchgehen, Mages suchen, Precombataura zurück */ } cv_next(s); + /* validate_sides(b); */ /* POSTCOMBAT */ do_combatmagic(b, DO_POSTCOMBATSPELL); diff --git a/src/common/kernel/combatspells.c b/src/common/kernel/combatspells.c index b0ce40ecb..99fda4667 100644 --- a/src/common/kernel/combatspells.c +++ b/src/common/kernel/combatspells.c @@ -941,7 +941,7 @@ sp_chaosrow(fighter * fi, int level, double power, spell * sp) n = df->unit->number; if (chance(power/n)) { - row = statusrow(df->status)+FIRST_ROW; + row = statusrow(df->status); df->side->size[row] -= df->alive; if (df->unit->race->battle_flags & BF_NOBLOCK) { df->side->nonblockers[row] -= df->alive; @@ -1747,12 +1747,12 @@ sp_undeadhero(fighter * fi, int level, double power, spell * sp) int hp = unit_max_hp(du); undead += j; df->side->casualties -= j; + df->side->dead -= j; if (j == du->number) { /* Einheit war vollständig tot und konnte vollständig zu * Untoten gemacht werden */ int nr; - df->side->dead -= j; df->side->alive += j; du->race = new_race[RC_UNDEAD]; setguard(du, GUARD_NONE); diff --git a/src/common/util/language.c b/src/common/util/language.c index 41ce5d890..80a8bd546 100644 --- a/src/common/util/language.c +++ b/src/common/util/language.c @@ -143,7 +143,7 @@ locale_setstring(locale * lang, const char * key, const char * value) find->str = strdup(value); } else { - if (strcmp(find->str, value)==0) { + if (strcmp(find->str, value)!=0) { log_error(("Duplicate key %s for '%s' and '%s'\n", key, value, find->str)); } assert(!strcmp(find->str, value) || !"duplicate string for key");