Преглед на файлове

Fixed counting of faction-aligned zones.

DjWarmonger преди 11 години
родител
ревизия
4b28afcaa4
променени са 2 файла, в които са добавени 9 реда и са изтрити 1 реда
  1. 9 0
      lib/rmg/CMapGenerator.cpp
  2. 0 1
      lib/rmg/CRmgTemplateZone.cpp

+ 9 - 0
lib/rmg/CMapGenerator.cpp

@@ -213,6 +213,10 @@ void CMapGenerator::genZones()
 
 void CMapGenerator::fillZones()
 {	
+	//init native town count with 0
+	for (auto faction : VLC->townh->getAllowedFactions())
+		zonesPerFaction[faction] = 0;
+
 	logGlobal->infoStream() << "Started filling zones";
 
 	createConnections();
@@ -220,6 +224,11 @@ void CMapGenerator::fillZones()
 	for (auto it : zones)
 	{
 		it.second->createBorder(this);
+		 //we need info about all town types to evaluate dwellings and pandoras with creatures properly
+		it.second->initTownType(this);
+	}
+	for (auto it : zones)
+	{
 		it.second->fill(this);
 	}	
 	logGlobal->infoStream() << "Zones filled successfully";

+ 0 - 1
lib/rmg/CRmgTemplateZone.cpp

@@ -1166,7 +1166,6 @@ void CRmgTemplateZone::createObstacles(CMapGenerator* gen)
 
 bool CRmgTemplateZone::fill(CMapGenerator* gen)
 {
-	initTownType(gen);
 	initTerrainType(gen);
 
 	freePaths.insert(pos); //zone center should be always clear to allow other tiles to connect