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:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user