1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fixed CID 1288863

This commit is contained in:
AlexVinS 2016-11-26 22:12:52 +03:00
parent 4b2bbd0d76
commit 30663f15ea
2 changed files with 7 additions and 2 deletions

View File

@ -785,7 +785,12 @@ void CInfoBar::CVisibleInfo::loadGameStatus()
//get amount of halls of each level //get amount of halls of each level
std::vector<int> halls(4, 0); std::vector<int> halls(4, 0);
for(auto town : LOCPLINT->towns) 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; std::vector<PlayerColor> allies, enemies;

View File

@ -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 int CGTownInstance::hallLevel() const // -1 - none, 0 - village, 1 - town, 2 - city, 3 - capitol
{ {
if (hasBuilt(BuildingID::CAPITOL)) if (hasBuilt(BuildingID::CAPITOL))
return 3; return 3;
if (hasBuilt(BuildingID::CITY_HALL)) if (hasBuilt(BuildingID::CITY_HALL))
@ -381,6 +380,7 @@ int CGTownInstance::hallLevel() const // -1 - none, 0 - village, 1 - town, 2 - c
return 0; return 0;
return -1; return -1;
} }
int CGTownInstance::mageGuildLevel() const int CGTownInstance::mageGuildLevel() const
{ {
if (hasBuilt(BuildingID::MAGES_GUILD_5)) if (hasBuilt(BuildingID::MAGES_GUILD_5))