sp_chaosrow, noch einmal gefixt. Immer noch ein Bug.

Irreführende Fehlermeldung entfernt
This commit is contained in:
Enno Rehling 2004-05-21 00:49:18 +00:00
parent 92ed12efb2
commit b93f1f5880
3 changed files with 23 additions and 3 deletions

View File

@ -152,6 +152,25 @@ static armor_type armordata[AR_NONE + 1] =
{ 0.00, 0.00, 0, 0, I_SWORD} { 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}; const troop no_troop = {0, 0};
region * region *
@ -2368,6 +2387,7 @@ aftermath(battle * b)
/* Alle Fighter durchgehen, Mages suchen, Precombataura zurück */ /* Alle Fighter durchgehen, Mages suchen, Precombataura zurück */
} cv_next(s); } cv_next(s);
/* validate_sides(b); */
/* POSTCOMBAT */ /* POSTCOMBAT */
do_combatmagic(b, DO_POSTCOMBATSPELL); do_combatmagic(b, DO_POSTCOMBATSPELL);

View File

@ -941,7 +941,7 @@ sp_chaosrow(fighter * fi, int level, double power, spell * sp)
n = df->unit->number; n = df->unit->number;
if (chance(power/n)) { if (chance(power/n)) {
row = statusrow(df->status)+FIRST_ROW; row = statusrow(df->status);
df->side->size[row] -= df->alive; df->side->size[row] -= df->alive;
if (df->unit->race->battle_flags & BF_NOBLOCK) { if (df->unit->race->battle_flags & BF_NOBLOCK) {
df->side->nonblockers[row] -= df->alive; 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); int hp = unit_max_hp(du);
undead += j; undead += j;
df->side->casualties -= j; df->side->casualties -= j;
df->side->dead -= j;
if (j == du->number) { if (j == du->number) {
/* Einheit war vollständig tot und konnte vollständig zu /* Einheit war vollständig tot und konnte vollständig zu
* Untoten gemacht werden */ * Untoten gemacht werden */
int nr; int nr;
df->side->dead -= j;
df->side->alive += j; df->side->alive += j;
du->race = new_race[RC_UNDEAD]; du->race = new_race[RC_UNDEAD];
setguard(du, GUARD_NONE); setguard(du, GUARD_NONE);

View File

@ -143,7 +143,7 @@ locale_setstring(locale * lang, const char * key, const char * value)
find->str = strdup(value); find->str = strdup(value);
} }
else { 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)); log_error(("Duplicate key %s for '%s' and '%s'\n", key, value, find->str));
} }
assert(!strcmp(find->str, value) || !"duplicate string for key"); assert(!strcmp(find->str, value) || !"duplicate string for key");