浏览代码

Fixed issue with empty mage guild on random maps.

DjWarmonger 11 年之前
父节点
当前提交
06983fc346
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      lib/rmg/CRmgTemplateZone.cpp

+ 12 - 0
lib/rmg/CRmgTemplateZone.cpp

@@ -958,6 +958,12 @@ void CRmgTemplateZone::initTownType (CMapGenerator* gen)
 				town->builtBuildings.insert(BuildingID::FORT);
 				town->builtBuildings.insert(BuildingID::FORT);
 			town->builtBuildings.insert(BuildingID::DEFAULT);
 			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) 
 			if (!totalTowns) 
 			{
 			{
 				//first town in zone sets the facton of entire zone
 				//first town in zone sets the facton of entire zone
@@ -996,6 +1002,12 @@ void CRmgTemplateZone::initTownType (CMapGenerator* gen)
 			town->tempOwner = player;
 			town->tempOwner = player;
 			town->builtBuildings.insert(BuildingID::FORT);
 			town->builtBuildings.insert(BuildingID::FORT);
 			town->builtBuildings.insert(BuildingID::DEFAULT);
 			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
 			//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
 			placeAndGuardObject(gen, town, getPos() + town->getVisitableOffset(), 0); //generate no guards, but free path to entrance
 			cutPathAroundTown(town);
 			cutPathAroundTown(town);