1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

Change spell school serialization

This commit is contained in:
AlexVinS 2014-11-13 16:57:49 +03:00
parent 787c970003
commit 5d1077161c
2 changed files with 12 additions and 10 deletions

View File

@ -430,10 +430,10 @@ void CSpell::setup()
{
setupMechanics();
school[ESpellSchool::AIR] = air;
school[ESpellSchool::FIRE] = fire;
school[ESpellSchool::WATER] = water;
school[ESpellSchool::EARTH] = earth;
air = school[ESpellSchool::AIR];
fire = school[ESpellSchool::FIRE];
water = school[ESpellSchool::WATER];
earth = school[ESpellSchool::EARTH];
}
@ -657,11 +657,11 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
logGlobal->traceStream() << __FUNCTION__ << ": loading spell " << spell->name;
const auto schoolNames = json["school"];
spell->air = schoolNames["air"].Bool();
spell->earth = schoolNames["earth"].Bool();
spell->fire = schoolNames["fire"].Bool();
spell->water = schoolNames["water"].Bool();
for(SpellSchoolInfo & info : spellSchoolConfig)
{
spell->school[info.id] = schoolNames[info.jsonName].Bool();
}
spell->level = json["level"].Float();
spell->power = json["power"].Float();

View File

@ -241,7 +241,7 @@ public:
template <typename Handler> void serialize(Handler &h, const int version)
{
h & identifier & id & name & level & earth & water & fire & air & power
h & identifier & id & name & level & power
& probabilities & attributes & combatSpell & creatureAbility & positiveness & counteredSpells & mainEffectAnim;
h & isRising & isDamage & isOffensive;
h & targetType;
@ -255,6 +255,8 @@ public:
h & levels;
h & school;
if(!h.saving)
setup();
}