|
@@ -11,6 +11,7 @@
|
|
|
#include "StdInc.h"
|
|
|
#include "CGTownInstance.h"
|
|
|
#include "CObjectClassesHandler.h"
|
|
|
+#include "../spells/CSpellHandler.h"
|
|
|
|
|
|
#include "../NetPacks.h"
|
|
|
#include "../CGeneralTextHandler.h"
|
|
@@ -1137,8 +1138,47 @@ void CGTownInstance::serializeJsonOptions(JsonSerializeFormat & handler)
|
|
|
builtBuildings.insert(BuildingID::DEFAULT);//just in case
|
|
|
}
|
|
|
|
|
|
+ //todo: serialize buildings
|
|
|
+// {
|
|
|
+// std::vector<bool> standard;
|
|
|
+// standard.resize(44, true);
|
|
|
+//
|
|
|
+//
|
|
|
+// JsonSerializeFormat::LIC buildingsLIC(, CTownHandler::decodeBuilding, CTownHandler::encodeBuilding);
|
|
|
+// }
|
|
|
|
|
|
- //todo: CGTownInstance::serializeJsonOptions
|
|
|
+ {
|
|
|
+ JsonSerializeFormat::LIC spellsLIC(VLC->spellh->getDefaultAllowed(), CSpellHandler::decodeSpell, CSpellHandler::encodeSpell);
|
|
|
+
|
|
|
+ for(SpellID id : possibleSpells)
|
|
|
+ spellsLIC.any[id.num] = true;
|
|
|
+
|
|
|
+ for(SpellID id : obligatorySpells)
|
|
|
+ spellsLIC.all[id.num] = true;
|
|
|
+
|
|
|
+ handler.serializeLIC("spells", spellsLIC);
|
|
|
+
|
|
|
+ if(!handler.saving)
|
|
|
+ {
|
|
|
+ possibleSpells.clear();
|
|
|
+ for(si32 idx = 0; idx < spellsLIC.any.size(); idx++)
|
|
|
+ {
|
|
|
+ if(spellsLIC.any[idx])
|
|
|
+ {
|
|
|
+ possibleSpells.push_back(SpellID(idx));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ obligatorySpells.clear();
|
|
|
+ for(si32 idx = 0; idx < spellsLIC.all.size(); idx++)
|
|
|
+ {
|
|
|
+ if(spellsLIC.all[idx])
|
|
|
+ {
|
|
|
+ obligatorySpells.push_back(SpellID(idx));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
COPWBonus::COPWBonus (BuildingID index, CGTownInstance *TOWN)
|