1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-04 00:15:53 +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(); setupMechanics();
school[ESpellSchool::AIR] = air; air = school[ESpellSchool::AIR];
school[ESpellSchool::FIRE] = fire; fire = school[ESpellSchool::FIRE];
school[ESpellSchool::WATER] = water; water = school[ESpellSchool::WATER];
school[ESpellSchool::EARTH] = earth; earth = school[ESpellSchool::EARTH];
} }
@ -657,11 +657,11 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
logGlobal->traceStream() << __FUNCTION__ << ": loading spell " << spell->name; logGlobal->traceStream() << __FUNCTION__ << ": loading spell " << spell->name;
const auto schoolNames = json["school"]; const auto schoolNames = json["school"];
spell->air = schoolNames["air"].Bool(); for(SpellSchoolInfo & info : spellSchoolConfig)
spell->earth = schoolNames["earth"].Bool(); {
spell->fire = schoolNames["fire"].Bool(); spell->school[info.id] = schoolNames[info.jsonName].Bool();
spell->water = schoolNames["water"].Bool(); }
spell->level = json["level"].Float(); spell->level = json["level"].Float();
spell->power = json["power"].Float(); spell->power = json["power"].Float();

View File

@ -241,7 +241,7 @@ public:
template <typename Handler> void serialize(Handler &h, const int version) 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; & probabilities & attributes & combatSpell & creatureAbility & positiveness & counteredSpells & mainEffectAnim;
h & isRising & isDamage & isOffensive; h & isRising & isDamage & isOffensive;
h & targetType; h & targetType;
@ -255,6 +255,8 @@ public:
h & levels; h & levels;
h & school;
if(!h.saving) if(!h.saving)
setup(); setup();
} }