mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Better error reporting for usages of invalid terrain in mods
TODO: switch to proper mechanism via identifier requests
This commit is contained in:
@@ -287,7 +287,15 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain)
|
|||||||
if(withTerrain && !node["allowedTerrains"].isNull())
|
if(withTerrain && !node["allowedTerrains"].isNull())
|
||||||
{
|
{
|
||||||
for(auto& entry : node["allowedTerrains"].Vector())
|
for(auto& entry : node["allowedTerrains"].Vector())
|
||||||
allowedTerrains.insert(VLC->terrainTypeHandler->getInfoByName(entry.String())->id);
|
{
|
||||||
|
try {
|
||||||
|
allowedTerrains.insert(VLC->terrainTypeHandler->getInfoByName(entry.String())->id);
|
||||||
|
}
|
||||||
|
catch (const std::out_of_range & )
|
||||||
|
{
|
||||||
|
logGlobal->warn("Failed to find terrain %s for object %s", entry.String(), animationFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -300,7 +308,7 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(withTerrain && allowedTerrains.empty())
|
if(withTerrain && allowedTerrains.empty())
|
||||||
logGlobal->warn("Loaded template without allowed terrains!");
|
logGlobal->warn("Loaded template %s without allowed terrains!", animationFile);
|
||||||
|
|
||||||
auto charToTile = [&](const char & ch) -> ui8
|
auto charToTile = [&](const char & ch) -> ui8
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user