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

Merge pull request #603 from dydzio0614/AiPrisonValueFix

Fix wrong AI prison value handling
This commit is contained in:
Alexander Shishkin 2019-06-06 05:13:50 +03:00 committed by GitHub
commit f6ab4c1f63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;