AlexVinS 9 anni fa
parent
commit
30663f15ea

+ 6 - 1
client/widgets/AdventureMapClasses.cpp

@@ -785,7 +785,12 @@ void CInfoBar::CVisibleInfo::loadGameStatus()
 	//get amount of halls of each level
 	std::vector<int> halls(4, 0);
 	for(auto town : LOCPLINT->towns)
-		halls[town->hallLevel()]++;
+	{
+		int hallLevel = town->hallLevel();
+		//negative value means no village hall, unlikely but possible
+		if(hallLevel >= 0)
+			halls.at(hallLevel)++;
+	}
 
 	std::vector<PlayerColor> allies, enemies;
 

+ 1 - 1
lib/mapObjects/CGTownInstance.cpp

@@ -370,7 +370,6 @@ CGTownInstance::EFortLevel CGTownInstance::fortLevel() const //0 - none, 1 - for
 
 int CGTownInstance::hallLevel() const // -1 - none, 0 - village, 1 - town, 2 - city, 3 - capitol
 {
-
 	if (hasBuilt(BuildingID::CAPITOL))
 		return 3;
 	if (hasBuilt(BuildingID::CITY_HALL))
@@ -381,6 +380,7 @@ int CGTownInstance::hallLevel() const // -1 - none, 0 - village, 1 - town, 2 - c
 		return 0;
 	return -1;
 }
+
 int CGTownInstance::mageGuildLevel() const
 {
 	if (hasBuilt(BuildingID::MAGES_GUILD_5))