1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Implemented CGWitchHut::serializeJsonOptions

This commit is contained in:
AlexVinS 2016-02-22 03:16:33 +03:00
parent 939e0128fd
commit 51bee1000b
2 changed files with 24 additions and 3 deletions

View File

@ -16,7 +16,7 @@
#include "../CGeneralTextHandler.h" #include "../CGeneralTextHandler.h"
#include "../CSoundBase.h" #include "../CSoundBase.h"
#include "../CModHandler.h" #include "../CModHandler.h"
#include "../CHeroHandler.h"
#include "CObjectClassesHandler.h" #include "CObjectClassesHandler.h"
#include "../spells/CSpellHandler.h" #include "../spells/CSpellHandler.h"
#include "../IGameCallback.h" #include "../IGameCallback.h"
@ -1500,7 +1500,29 @@ std::string CGWitchHut::getHoverText(const CGHeroInstance * hero) const
void CGWitchHut::serializeJsonOptions(JsonSerializeFormat & handler) void CGWitchHut::serializeJsonOptions(JsonSerializeFormat & handler)
{ {
//todo:CGWitchHut::serializeJsonOptions //TODO: unify allowed abilities with others - make them std::vector<bool>
std::vector<bool> temp;
temp.resize(GameConstants::SKILL_QUANTITY, false);
auto standard = VLC->heroh->getDefaultAllowedAbilities(); //todo: for WitchHut default is all except Leadership and Necromancy
if(handler.saving)
{
for(si32 i = 0; i < GameConstants::SKILL_QUANTITY; ++i)
if(vstd::contains(allowedAbilities, i))
temp[i] = true;
}
handler.serializeLIC("allowedSkills", &CHeroHandler::decodeSkill, &CHeroHandler::encodeSkill, standard, temp);
if(!handler.saving)
{
allowedAbilities.clear();
for (si32 i=0; i<temp.size(); i++)
if(temp[i])
allowedAbilities.push_back(i);
}
} }
void CGMagicWell::onHeroVisit( const CGHeroInstance * h ) const void CGMagicWell::onHeroVisit( const CGHeroInstance * h ) const

View File

@ -539,7 +539,6 @@ JsonNode CMapLoaderJson::getFromArchive(const std::string & archiveFilename)
return std::move(res); return std::move(res);
} }
void CMapLoaderJson::readMap() void CMapLoaderJson::readMap()
{ {
LOG_TRACE(logGlobal); LOG_TRACE(logGlobal);