1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-28 23:06:24 +02:00

Add better runtime error on invalid building ID

This commit is contained in:
Ivan Savenko 2024-06-20 10:08:49 +00:00
parent f0ad2e042e
commit 0d3408ee68

View File

@ -1540,6 +1540,9 @@ CHallInterface::CHallInterface(const CGTownInstance * Town):
const CBuilding * building = nullptr;
for(auto & buildingID : boxList[row][col])//we are looking for the first not built structure
{
if (town->town->buildings.count(buildingID) == 0)
throw std::runtime_error("Town " + Town->town->faction->getJsonKey() + " has no building with ID " + std::to_string(buildingID.getNum()));
const CBuilding * current = town->town->buildings.at(buildingID);
if(vstd::contains(town->builtBuildings, buildingID))
{