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,8 +287,16 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain)
|
||||
if(withTerrain && !node["allowedTerrains"].isNull())
|
||||
{
|
||||
for(auto& entry : node["allowedTerrains"].Vector())
|
||||
{
|
||||
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
|
||||
{
|
||||
for(const auto & terrain : VLC->terrainTypeHandler->terrains())
|
||||
@@ -300,7 +308,7 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain)
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
Reference in New Issue
Block a user