1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

fixed the shmup crash bug

This commit is contained in:
Zeno Rogue 2017-09-04 20:43:17 +02:00
parent 73841570ea
commit 031e423819

View File

@ -3020,6 +3020,8 @@ void turn(int delta) {
if(m->dead && m->type != moPlayer) { if(m->dead && m->type != moPlayer) {
for(monster *m2: active) if(m2->parent == m) for(monster *m2: active) if(m2->parent == m)
m2->parent = m->parent; m2->parent = m->parent;
if(m == mousetarget) mousetarget = NULL;
if(m == lmousetarget) lmousetarget = NULL;
delete m; delete m;
} }
else { else {
@ -3219,6 +3221,8 @@ void clearMonsters() {
for(mit it = monstersAt.begin(); it != monstersAt.end(); it++) for(mit it = monstersAt.begin(); it != monstersAt.end(); it++)
delete(it->second); delete(it->second);
for(monster *m: active) delete m; for(monster *m: active) delete m;
mousetarget = NULL;
lmousetarget = NULL;
monstersAt.clear(); monstersAt.clear();
active.clear(); active.clear();
} }