mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix AI value handling for heroes
This commit is contained in:
parent
845f0fbf5c
commit
8ec558a2ae
@ -3,6 +3,8 @@
|
||||
#include "../../lib/GameConstants.h"
|
||||
#include "../../lib/VCMI_Lib.h"
|
||||
#include "../../lib/CCreatureHandler.h"
|
||||
#include "../../lib/CHeroHandler.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||
#include "../../lib/mapObjects/MiscObjects.h"
|
||||
#include "../../lib/CRandomGenerator.h"
|
||||
@ -56,6 +58,12 @@ boost::optional<int> MapObjectsEvaluator::getObjectValue(int primaryID, int seco
|
||||
|
||||
boost::optional<int> MapObjectsEvaluator::getObjectValue(const CGObjectInstance * obj) const
|
||||
{
|
||||
if(obj->ID == Obj::HERO)
|
||||
{
|
||||
//special case handling: in-game heroes have hero ID as object subID, but when reading configs available hero object subID's are hero classes
|
||||
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)
|
||||
{
|
||||
auto dwelling = dynamic_cast<const CGDwelling *>(obj);
|
||||
|
Loading…
Reference in New Issue
Block a user