1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Allow all terrains from mods by default (including Wasteland).

This commit is contained in:
Tomasz Zieliński 2023-07-02 08:13:06 +02:00
parent dc3dda7676
commit 04e2cf728e
2 changed files with 15 additions and 11 deletions

View File

@ -145,9 +145,6 @@ ZoneOptions::ZoneOptions():
terrainTypeLikeZone(NO_ZONE),
treasureLikeZone(NO_ZONE)
{
for(const auto & terr : VLC->terrainTypeHandler->objects)
if(terr->isLand() && terr->isPassable())
terrainTypes.insert(terr->getId());
}
TRmgTemplateZoneId ZoneOptions::getId() const
@ -804,8 +801,6 @@ void CRmgTemplate::afterLoad()
for(const auto & connection : connectedZoneIds)
{
//TODO: Remember connection details and allow to access them from anywhere
auto id1 = connection.getZoneA();
auto id2 = connection.getZoneB();

View File

@ -73,13 +73,22 @@ void TerrainPainter::initTerrainType()
auto terrainTypes = zone.getTerrainTypes();
if (terrainTypes.empty())
{
logGlobal->warn("No terrain types found, falling back to DIRT");
zone.setTerrainType(ETerrainId::DIRT);
}
else
{
zone.setTerrainType(*RandomGeneratorUtil::nextItem(terrainTypes, zone.getRand()));
//Fill with all terain types by default
{
for (auto terrain : VLC->terrainTypeHandler->objects)
{
if (terrain->isLand() && terrain->isPassable())
{
if (terrain->isSurface() && !zone.isUnderground() ||
terrain->isUnderground() && zone.isUnderground())
{
terrainTypes.insert(terrain->getId());
}
}
}
}
}
zone.setTerrainType(*RandomGeneratorUtil::nextItem(terrainTypes, zone.getRand()));
}
//Now, replace disallowed terrains on surface and in the underground