mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Correctly restore bonus system on deserialization
This commit is contained in:
@@ -153,6 +153,34 @@ CBonusSystemNode & CArmedInstance::whatShouldBeAttached()
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CArmedInstance::attachToBonusSystem(CGameState * gs)
|
||||
{
|
||||
CArmedInstance::restoreBonusSystem(gs);
|
||||
}
|
||||
|
||||
void CArmedInstance::restoreBonusSystem(CGameState * gs)
|
||||
{
|
||||
whatShouldBeAttached().attachTo(whereShouldBeAttached(gs));
|
||||
|
||||
for(const auto & elem : stacks)
|
||||
elem.second->artDeserializationFix(gs, elem.second.get());
|
||||
}
|
||||
|
||||
void CArmedInstance::detachFromBonusSystem(CGameState * gs)
|
||||
{
|
||||
whatShouldBeAttached().detachFrom(whereShouldBeAttached(gs));
|
||||
|
||||
// TODO: the opposite
|
||||
// for(const auto & elem : stacks)
|
||||
// elem.second->artDeserializationFix(elem.second.get());
|
||||
}
|
||||
|
||||
void CArmedInstance::attachUnitsToArmy()
|
||||
{
|
||||
for(const auto & elem : stacks)
|
||||
elem.second->attachTo(*getArmy());
|
||||
}
|
||||
|
||||
const IBonusBearer* CArmedInstance::getBonusBearer() const
|
||||
{
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user