forked from github/server
removing units (versteinern) cleaned up and now invalidates the fast-cache so the assert shouldn't trigger any more.
This commit is contained in:
parent
e7e0ef994b
commit
07cb8d1fad
|
@ -817,7 +817,7 @@ rmfighter(fighter *df, int i)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rmtroop(troop dt)
|
||||
{
|
||||
fighter *df = dt.fighter;
|
||||
|
@ -835,6 +835,24 @@ rmtroop(troop dt)
|
|||
|
||||
void
|
||||
remove_troop(troop dt)
|
||||
{
|
||||
fighter * df = dt.fighter;
|
||||
struct person p = df->person[dt.index];
|
||||
battle * b = df->side->battle;
|
||||
#ifdef FASTCOUNT
|
||||
b->fast.alive = -1; /* invalidate cached value */
|
||||
#endif
|
||||
#ifdef FASTROW
|
||||
b->rowcache.alive = -1; /* invalidate cached value */
|
||||
#endif
|
||||
++df->removed;
|
||||
++df->side->removed;
|
||||
df->person[dt.index] = df->person[df->alive-df->removed];
|
||||
df->person[df->alive - df->removed] = p;
|
||||
}
|
||||
|
||||
void
|
||||
kill_troop(troop dt)
|
||||
{
|
||||
fighter * df = dt.fighter;
|
||||
unit * du = df->unit;
|
||||
|
@ -1211,7 +1229,7 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
|||
if (rng_int() % 4 < 1) i_change(pitm, itype, -1);
|
||||
}
|
||||
}
|
||||
remove_troop(dt);
|
||||
kill_troop(dt);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3687,7 +3705,7 @@ flee(const troop dt)
|
|||
fig->run.hp += fig->person[dt.index].hp;
|
||||
++fig->run.number;
|
||||
|
||||
remove_troop(dt);
|
||||
kill_troop(dt);
|
||||
}
|
||||
|
||||
#ifdef DELAYED_OFFENSE
|
||||
|
|
|
@ -254,7 +254,8 @@ extern "C" {
|
|||
extern fighter * make_fighter(struct battle * b, struct unit * u, side * s, boolean attack);
|
||||
extern int statusrow(int status);
|
||||
extern void drain_exp(struct unit *u, int d);
|
||||
extern void rmtroop(troop dt);
|
||||
extern void kill_troop(troop dt);
|
||||
extern void remove_troop(troop dt); /* not the same as the badly named rmtroop */
|
||||
extern boolean is_attacker(const fighter * fig);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -184,16 +184,11 @@ sp_versteinern(fighter * fi, int level, double power, spell * sp)
|
|||
|
||||
while (force && stoned < enemies) {
|
||||
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||
fighter * df = dt.fighter;
|
||||
unit * du = df->unit;
|
||||
unit * du = dt.fighter->unit;
|
||||
if (is_magic_resistant(mage, du, 0) == false) {
|
||||
/* person ans ende hinter die lebenden schieben */
|
||||
struct person p = dt.fighter->person[dt.index];
|
||||
++dt.fighter->removed;
|
||||
++dt.fighter->side->removed;
|
||||
remove_troop(dt);
|
||||
++stoned;
|
||||
dt.fighter->person[dt.index] = dt.fighter->person[df->alive-df->removed];
|
||||
dt.fighter->person[(df->alive - df->removed)] = p;
|
||||
}
|
||||
--force;
|
||||
}
|
||||
|
@ -528,7 +523,7 @@ sp_mindblast(fighter * fi, int level, double power, spell * sp)
|
|||
reduce_skill(du, sv, n);
|
||||
} else {
|
||||
/* Keine Skills mehr, Einheit töten */
|
||||
rmtroop(dt);
|
||||
kill_troop(dt);
|
||||
++killed;
|
||||
}
|
||||
--enemies;
|
||||
|
|
Loading…
Reference in New Issue