1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Merge remote-tracking branch 'vcmi/beta' into develop

This commit is contained in:
Ivan Savenko
2023-08-12 17:28:47 +03:00
95 changed files with 1628 additions and 1144 deletions

View File

@ -316,11 +316,21 @@ std::vector<bool> CObjectClassesHandler::getDefaultAllowed() const
TObjectTypeHandler CObjectClassesHandler::getHandlerFor(si32 type, si32 subtype) const
{
assert(type < objects.size());
assert(objects[type]);
assert(subtype < objects[type]->objects.size());
try
{
auto result = objects.at(type)->objects.at(subtype);
return objects.at(type)->objects.at(subtype);
if (result != nullptr)
return result;
}
catch (std::out_of_range & e)
{
// Leave catch block silently
}
std::string errorString = "Failed to find object of type " + std::to_string(type) + "::" + std::to_string(subtype);
logGlobal->error(errorString);
throw std::runtime_error(errorString);
}
TObjectTypeHandler CObjectClassesHandler::getHandlerFor(const std::string & scope, const std::string & type, const std::string & subtype) const