1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-18 17:40:48 +02:00

Proper erasing for exception objects

This commit is contained in:
nordsoft 2022-09-06 05:50:00 +04:00
parent 667f05843a
commit 9c1971788b

View File

@ -641,6 +641,19 @@ void CMap::removeObject(CGObjectInstance * obj)
{ {
(*iter)->id = ObjectInstanceID(i); (*iter)->id = ObjectInstanceID(i);
} }
auto iterTown = std::find(towns.begin(), towns.end(), obj);
if(iterTown != towns.end())
towns.erase(iterTown);
auto iterArt = std::find(artInstances.begin(), artInstances.end(), obj);
if(iterArt != artInstances.end())
artInstances.erase(iterArt);
auto iterHero = std::find(allHeroes.begin(), allHeroes.end(), obj);
if(iterHero != allHeroes.end())
allHeroes.erase(iterHero);
iterHero = std::find(heroesOnMap.begin(), heroesOnMap.end(), obj);
if(iterHero != heroesOnMap.end())
heroesOnMap.erase(iterHero);
} }
void CMap::initTerrain() void CMap::initTerrain()