1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

VCAI::objectRemoved: handle hero boat removal. Fix issue 2350

Avoid situation when AI attempt to visit boat after it's killed hero who used it.
This commit is contained in:
Arseniy Shestakov 2016-09-04 15:44:42 +03:00
parent 11a1cf0493
commit 8e94b1c4d2

View File

@ -398,6 +398,16 @@ void VCAI::objectRemoved(const CGObjectInstance *obj)
for (auto h : cb->getHeroesInfo())
unreserveObject(h, obj);
//TODO: Find better way to handle hero boat removal
if(auto hero = dynamic_cast<const CGHeroInstance *>(obj))
{
if(hero->boat)
{
vstd::erase_if_present(visitableObjs, hero->boat);
vstd::erase_if_present(alreadyVisited, hero->boat);
}
}
cachedSectorMaps.clear(); //invalidate all paths
//TODO