1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-31 00:07:39 +02:00

Initialize town's possibleSpells only if hasn't been initialized already(for example when copying existing town)

This commit is contained in:
godric3
2024-10-26 12:15:40 +02:00
parent 1826b5bbdf
commit 1246333350

View File

@@ -172,10 +172,12 @@ void Initializer::initialize(CGTownInstance * o)
if(lvl > 2) o->addBuilding(BuildingID::CASTLE);
if(lvl > 3) o->addBuilding(BuildingID::CAPITOL);
for(auto const & spell : VLC->spellh->objects) //add all regular spells to town
if(o->possibleSpells.empty())
{
if(!spell->isSpecial() && !spell->isCreatureAbility())
o->possibleSpells.push_back(spell->id);
for(auto const & spellId : VLC->spellh->getDefaultAllowed()) //add all regular spells to town
{
o->possibleSpells.push_back(spellId);
}
}
}