From e5d5678900e78f04ca84d2fccd4371dace2004c9 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 22 May 2018 20:40:52 +0200 Subject: [PATCH] fixed a bug in fixStorage --- shmup.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/shmup.cpp b/shmup.cpp index b9ff6f01..bd83d11d 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -2861,12 +2861,14 @@ void activateMonstersAt(cell *c) { } void fixStorage() { + vector restore; - for(auto it = monstersAt.begin(); it != monstersAt.end(); it++) - if(it->second->base != it->first) { - restore.push_back(it->second); - monstersAt.erase(it++); - } + + for(auto it = monstersAt.begin(); it != monstersAt.end(); it++) + restore.push_back(it->second); + + monstersAt.clear(); + for(monster *m: restore) m->store(); }