1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-15 20:03:15 +02:00

Fixed issue with empty mage guild on random maps.

This commit is contained in:
DjWarmonger
2014-10-26 13:09:59 +01:00
parent c87f2cdaaf
commit 06983fc346

View File

@@ -958,6 +958,12 @@ void CRmgTemplateZone::initTownType (CMapGenerator* gen)
town->builtBuildings.insert(BuildingID::FORT);
town->builtBuildings.insert(BuildingID::DEFAULT);
for (auto spell : VLC->spellh->objects) //add all regular spells to town
{
if (!spell->isSpecialSpell() && !spell->isCreatureAbility())
town->possibleSpells.push_back(spell->id);
}
if (!totalTowns)
{
//first town in zone sets the facton of entire zone
@@ -996,6 +1002,12 @@ void CRmgTemplateZone::initTownType (CMapGenerator* gen)
town->tempOwner = player;
town->builtBuildings.insert(BuildingID::FORT);
town->builtBuildings.insert(BuildingID::DEFAULT);
for (auto spell : VLC->spellh->objects) //add all regular spells to town
{
if (!spell->isSpecialSpell() && !spell->isCreatureAbility())
town->possibleSpells.push_back(spell->id);
}
//towns are big objects and should be centered around visitable position
placeAndGuardObject(gen, town, getPos() + town->getVisitableOffset(), 0); //generate no guards, but free path to entrance
cutPathAroundTown(town);