1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-15 11:46:56 +02:00

Fix wrong AI prison value handling

This commit is contained in:
Dydzio 2019-06-05 23:07:22 +02:00
parent b16af04a09
commit 4be4e10fe9

View File

@ -64,7 +64,12 @@ boost::optional<int> MapObjectsEvaluator::getObjectValue(const CGObjectInstance
auto hero = dynamic_cast<const CGHeroInstance*>(obj);
return getObjectValue(obj->ID, hero->type->heroClass->id);
}
if(obj->ID == Obj::CREATURE_GENERATOR1 || obj->ID == Obj::CREATURE_GENERATOR4)
else if(obj->ID == Obj::PRISON)
{
//special case: in-game prison subID is captured hero ID, but config has one subID with index 0 for normal prison - use that one
return getObjectValue(obj->ID, 0);
}
else if(obj->ID == Obj::CREATURE_GENERATOR1 || obj->ID == Obj::CREATURE_GENERATOR4)
{
auto dwelling = dynamic_cast<const CGDwelling *>(obj);
int aiValue = 0;