diff --git a/client/widgets/AdventureMapClasses.cpp b/client/widgets/AdventureMapClasses.cpp index 8d06cbbd0..ac6306021 100644 --- a/client/widgets/AdventureMapClasses.cpp +++ b/client/widgets/AdventureMapClasses.cpp @@ -785,7 +785,12 @@ void CInfoBar::CVisibleInfo::loadGameStatus() //get amount of halls of each level std::vector 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 allies, enemies; diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index 88bb14dfc..8bad6042f 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/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))