1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Advance map header serialization

This commit is contained in:
AlexVinS
2016-02-21 20:58:09 +03:00
parent b6103167f7
commit 53b5587c2e
16 changed files with 230 additions and 75 deletions

View File

@ -1078,6 +1078,27 @@ CSpellHandler::~CSpellHandler()
std::vector<bool> CSpellHandler::getDefaultAllowed() const
{
std::vector<bool> allowedSpells;
allowedSpells.resize(GameConstants::SPELLS_QUANTITY, true);
allowedSpells.reserve(objects.size());
for(const CSpell * s : objects)
{
allowedSpells.push_back( !(s->isSpecialSpell() || s->isCreatureAbility()));
}
return allowedSpells;
}
si32 CSpellHandler::decodeSpell(const std::string& identifier)
{
auto rawId = VLC->modh->identifiers.getIdentifier("core", "spell", identifier);
if(rawId)
return rawId.get();
else
return -1;
}
std::string CSpellHandler::encodeSpell(const si32 index)
{
return VLC->spellh->objects[index]->identifier;
}