Переглянути джерело

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

godric3 1 рік тому
батько
коміт
1246333350
1 змінених файлів з 5 додано та 3 видалено
  1. 5 3
      mapeditor/inspector/inspector.cpp

+ 5 - 3
mapeditor/inspector/inspector.cpp

@@ -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);
+		}
 	}
 }