mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Improvements to bonus system node types / propagators
- Node type is now set on construction and never changes - Added army propagator that also checks for TOWN and HERO - Renamed existing propagators to be in sync with enumeration
This commit is contained in:
@@ -26,7 +26,7 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
///CStack
|
||||
CStack::CStack(const CStackInstance * Base, const PlayerColor & O, int I, BattleSide Side, const SlotID & S):
|
||||
CBonusSystemNode(STACK_BATTLE),
|
||||
CBonusSystemNode(BonusNodeType::STACK_BATTLE),
|
||||
base(Base),
|
||||
ID(I),
|
||||
typeID(Base->getId()),
|
||||
@@ -40,7 +40,7 @@ CStack::CStack(const CStackInstance * Base, const PlayerColor & O, int I, Battle
|
||||
}
|
||||
|
||||
CStack::CStack():
|
||||
CBonusSystemNode(STACK_BATTLE),
|
||||
CBonusSystemNode(BonusNodeType::STACK_BATTLE),
|
||||
owner(PlayerColor::NEUTRAL),
|
||||
slot(SlotID(255)),
|
||||
initialPosition(BattleHex())
|
||||
@@ -48,7 +48,7 @@ CStack::CStack():
|
||||
}
|
||||
|
||||
CStack::CStack(const CStackBasicDescriptor * stack, const PlayerColor & O, int I, BattleSide Side, const SlotID & S):
|
||||
CBonusSystemNode(STACK_BATTLE),
|
||||
CBonusSystemNode(BonusNodeType::STACK_BATTLE),
|
||||
ID(I),
|
||||
typeID(stack->getId()),
|
||||
baseAmount(stack->getCount()),
|
||||
@@ -155,7 +155,7 @@ const CGHeroInstance * CStack::getMyHero() const
|
||||
return dynamic_cast<const CGHeroInstance *>(base->getArmy());
|
||||
else //we are attached directly?
|
||||
for(const CBonusSystemNode * n : getParentNodes())
|
||||
if(n->getNodeType() == HERO)
|
||||
if(n->getNodeType() == BonusNodeType::HERO)
|
||||
return dynamic_cast<const CGHeroInstance *>(n);
|
||||
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user