|
@@ -45,10 +45,11 @@ ChainActor::ChainActor(const CGHeroInstance * hero, HeroRole heroRole, uint64_t
|
|
|
initialTurn = 0;
|
|
|
armyValue = hero->getArmyStrength();
|
|
|
heroFightingStrength = hero->getFightingStrength();
|
|
|
+ tiCache.reset(new TurnInfo(hero));
|
|
|
}
|
|
|
|
|
|
ChainActor::ChainActor(const ChainActor * carrier, const ChainActor * other, const CCreatureSet * heroArmy)
|
|
|
- :hero(carrier->hero), heroRole(carrier->heroRole), isMovable(true), creatureSet(heroArmy), chainMask(carrier->chainMask | other->chainMask),
|
|
|
+ :hero(carrier->hero), tiCache(carrier->tiCache), heroRole(carrier->heroRole), isMovable(true), creatureSet(heroArmy), chainMask(carrier->chainMask | other->chainMask),
|
|
|
baseActor(this), carrierParent(carrier), otherParent(other), heroFightingStrength(carrier->heroFightingStrength),
|
|
|
actorExchangeCount(carrier->actorExchangeCount + other->actorExchangeCount), armyCost(carrier->armyCost + other->armyCost), actorAction()
|
|
|
{
|
|
@@ -65,6 +66,16 @@ ChainActor::ChainActor(const CGObjectInstance * obj, const CCreatureSet * creatu
|
|
|
armyValue = creatureSet->getArmyStrength();
|
|
|
}
|
|
|
|
|
|
+int ChainActor::maxMovePoints(CGPathNode::ELayer layer)
|
|
|
+{
|
|
|
+#if AI_TRACE_LEVEL > 0
|
|
|
+ if(!hero)
|
|
|
+ throw std::exception("Asking movement points for static actor");
|
|
|
+#endif
|
|
|
+
|
|
|
+ return hero->maxMovePointsCached(layer, tiCache.get());
|
|
|
+}
|
|
|
+
|
|
|
std::string ChainActor::toString() const
|
|
|
{
|
|
|
return hero->name;
|
|
@@ -120,6 +131,7 @@ void ChainActor::setBaseActor(HeroActor * base)
|
|
|
heroFightingStrength = base->heroFightingStrength;
|
|
|
armyCost = base->armyCost;
|
|
|
actorAction = base->actorAction;
|
|
|
+ tiCache = base->tiCache;
|
|
|
}
|
|
|
|
|
|
void HeroActor::setupSpecialActors()
|