mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fixed #682.
This commit is contained in:
@@ -1242,6 +1242,7 @@ void BattleInfo::localInit()
|
|||||||
|
|
||||||
BOOST_FOREACH(CStack *s, stacks)
|
BOOST_FOREACH(CStack *s, stacks)
|
||||||
{
|
{
|
||||||
|
s->exportBonuses();
|
||||||
if(s->base) //stack originating from "real" stack in garrison -> attach to it
|
if(s->base) //stack originating from "real" stack in garrison -> attach to it
|
||||||
{
|
{
|
||||||
s->attachTo(const_cast<CStackInstance*>(s->base));
|
s->attachTo(const_cast<CStackInstance*>(s->base));
|
||||||
@@ -1255,6 +1256,8 @@ void BattleInfo::localInit()
|
|||||||
}
|
}
|
||||||
s->postInit();
|
s->postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exportBonuses();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CGH
|
namespace CGH
|
||||||
|
@@ -517,8 +517,8 @@ std::string CBonusSystemNode::nodeName() const
|
|||||||
|
|
||||||
void CBonusSystemNode::deserializationFix()
|
void CBonusSystemNode::deserializationFix()
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(Bonus *b, exportedBonuses)
|
exportBonuses();
|
||||||
exportBonus(b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBonusSystemNode::getRedParents(TNodes &out)
|
void CBonusSystemNode::getRedParents(TNodes &out)
|
||||||
@@ -615,6 +615,12 @@ void CBonusSystemNode::exportBonus(Bonus * b)
|
|||||||
bonuses.push_back(b);
|
bonuses.push_back(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBonusSystemNode::exportBonuses()
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(Bonus *b, exportedBonuses)
|
||||||
|
exportBonus(b);
|
||||||
|
}
|
||||||
|
|
||||||
int NBonus::valOf(const CBonusSystemNode *obj, Bonus::BonusType type, int subtype /*= -1*/)
|
int NBonus::valOf(const CBonusSystemNode *obj, Bonus::BonusType type, int subtype /*= -1*/)
|
||||||
{
|
{
|
||||||
if(obj)
|
if(obj)
|
||||||
|
@@ -450,17 +450,19 @@ public:
|
|||||||
void removeBonus(Bonus *b);
|
void removeBonus(Bonus *b);
|
||||||
void newRedDescendant(CBonusSystemNode *descendant); //propagation needed
|
void newRedDescendant(CBonusSystemNode *descendant); //propagation needed
|
||||||
void removedRedDescendant(CBonusSystemNode *descendant); //de-propagation needed
|
void removedRedDescendant(CBonusSystemNode *descendant); //de-propagation needed
|
||||||
|
void battleTurnPassed(); //updates count of remaining turns and removed outdated bonuses
|
||||||
|
|
||||||
bool isIndependentNode() const; //node is independent when it has no parents nor children
|
bool isIndependentNode() const; //node is independent when it has no parents nor children
|
||||||
bool actsAsBonusSourceOnly() const;
|
bool actsAsBonusSourceOnly() const;
|
||||||
bool isLimitedOnUs(Bonus *b) const; //if bonus should be removed from list acquired from this node
|
bool isLimitedOnUs(Bonus *b) const; //if bonus should be removed from list acquired from this node
|
||||||
|
|
||||||
void battleTurnPassed(); //updates count of remaining turns and removed outdated bonuses
|
|
||||||
void popBonuses(const CSelector &s);
|
void popBonuses(const CSelector &s);
|
||||||
virtual std::string bonusToString(Bonus *bonus, bool description) const {return "";}; //description or bonus name
|
virtual std::string bonusToString(Bonus *bonus, bool description) const {return "";}; //description or bonus name
|
||||||
virtual std::string nodeName() const;
|
virtual std::string nodeName() const;
|
||||||
|
|
||||||
void deserializationFix();
|
void deserializationFix();
|
||||||
void exportBonus(Bonus * b);
|
void exportBonus(Bonus * b);
|
||||||
|
void exportBonuses();
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user