1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Quick fix for major spell configuration bug

* clean fix requires save format change
This commit is contained in:
AlexVinS
2015-04-11 13:14:26 +03:00
parent 2d8288d95a
commit 41f1d3f21f
2 changed files with 14 additions and 3 deletions

View File

@@ -980,7 +980,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode & json)
if(usePowerAsValue)
b->val = levelPower;
levelObject.effects.push_back(*b);
levelObject.effectsTmp.push_back(b);
}
}
@@ -994,9 +994,18 @@ void CSpellHandler::afterLoadFinalization()
for(auto spell: objects)
{
for(auto & level: spell->levels)
{
for(Bonus * bonus : level.effectsTmp)
{
level.effects.push_back(*bonus);
delete bonus;
}
level.effectsTmp.clear();
for(auto & bonus: level.effects)
bonus.sid = spell->id;
spell->setup();
bonus.sid = spell->id;
}
spell->setup();
}
}

View File

@@ -153,6 +153,8 @@ public:
std::string range;
std::vector<Bonus> effects;
std::vector<Bonus *> effectsTmp; //TODO: this should replace effects
LevelInfo();
~LevelInfo();