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:
parent
11a1cf0493
commit
8e94b1c4d2
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user