mirror of
https://github.com/vcmi/vcmi.git
synced 2025-10-08 23:22:25 +02:00
Merge pull request #6104 from MichalZr6/building_upgrades_fix
Log error instead of throw when upgrade is same building ID
This commit is contained in:
@@ -361,14 +361,18 @@ void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, cons
|
||||
// building id and upgrades can't be the same
|
||||
if(stringID == source["upgrades"].String())
|
||||
{
|
||||
throw std::runtime_error(boost::str(boost::format("Building with ID '%s' of town '%s' can't be an upgrade of the same building.") %
|
||||
stringID % ret->town->faction->getNameTranslated()));
|
||||
auto townName = ret->town->faction->getNameTranslated();
|
||||
logMod->error("Building with ID '%s' of town '%s' can't be an upgrade of the same building.", stringID, townName);
|
||||
throw std::runtime_error(boost::str(boost::format("Building with ID '%s' of town '%s' can't be an upgrade of the same building.")
|
||||
% stringID % townName));
|
||||
}
|
||||
|
||||
LIBRARY->identifiers()->requestIdentifier(ret->town->getBuildingScope(), source["upgrades"], [=](si32 identifier)
|
||||
else
|
||||
{
|
||||
ret->upgrade = BuildingID(identifier);
|
||||
});
|
||||
LIBRARY->identifiers()->requestIdentifier(ret->town->getBuildingScope(), source["upgrades"], [=](si32 identifier)
|
||||
{
|
||||
ret->upgrade = BuildingID(identifier);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
ret->upgrade = BuildingID::NONE;
|
||||
|
Reference in New Issue
Block a user