Răsfoiți Sursa

Merge pull request #603 from dydzio0614/AiPrisonValueFix

Fix wrong AI prison value handling
Alexander Shishkin 6 ani în urmă
părinte
comite
f6ab4c1f63
1 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 6 1
      AI/VCAI/MapObjectsEvaluator.cpp

+ 6 - 1
AI/VCAI/MapObjectsEvaluator.cpp

@@ -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;