mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Added check for validness of native terrain
This commit is contained in:
parent
c45d4f8d22
commit
4f739d426d
@ -19,6 +19,7 @@
|
|||||||
#include "CHeroHandler.h"
|
#include "CHeroHandler.h"
|
||||||
#include "CArtHandler.h"
|
#include "CArtHandler.h"
|
||||||
#include "GameSettings.h"
|
#include "GameSettings.h"
|
||||||
|
#include "TerrainHandler.h"
|
||||||
#include "spells/CSpellHandler.h"
|
#include "spells/CSpellHandler.h"
|
||||||
#include "filesystem/Filesystem.h"
|
#include "filesystem/Filesystem.h"
|
||||||
#include "mapObjects/CObjectClassesHandler.h"
|
#include "mapObjects/CObjectClassesHandler.h"
|
||||||
@ -1035,6 +1036,11 @@ CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode
|
|||||||
{
|
{
|
||||||
VLC->modh->identifiers.requestIdentifier("terrain", source["nativeTerrain"], [=](int32_t index){
|
VLC->modh->identifiers.requestIdentifier("terrain", source["nativeTerrain"], [=](int32_t index){
|
||||||
faction->nativeTerrain = TerrainId(index);
|
faction->nativeTerrain = TerrainId(index);
|
||||||
|
|
||||||
|
auto const & terrain = VLC->terrainTypeHandler->getById(faction->nativeTerrain);
|
||||||
|
|
||||||
|
if (!terrain->isSurface() && !terrain->isUnderground())
|
||||||
|
logMod->warn("Faction %s has terrain %s as native, but terrain is not suitable for either surface or subterranean layers!", faction->getJsonKey(), terrain->getJsonKey());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user