1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-27 12:22:45 +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), terrainTypeLikeZone(NO_ZONE),
treasureLikeZone(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 TRmgTemplateZoneId ZoneOptions::getId() const
@ -804,8 +801,6 @@ void CRmgTemplate::afterLoad()
for(const auto & connection : connectedZoneIds) for(const auto & connection : connectedZoneIds)
{ {
//TODO: Remember connection details and allow to access them from anywhere
auto id1 = connection.getZoneA(); auto id1 = connection.getZoneA();
auto id2 = connection.getZoneB(); auto id2 = connection.getZoneB();

View File

@ -73,14 +73,23 @@ void TerrainPainter::initTerrainType()
auto terrainTypes = zone.getTerrainTypes(); auto terrainTypes = zone.getTerrainTypes();
if (terrainTypes.empty()) if (terrainTypes.empty())
{ {
logGlobal->warn("No terrain types found, falling back to DIRT"); //Fill with all terain types by default
zone.setTerrainType(ETerrainId::DIRT);
}
else
{ {
zone.setTerrainType(*RandomGeneratorUtil::nextItem(terrainTypes, zone.getRand())); 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 //Now, replace disallowed terrains on surface and in the underground
const auto & terrainType = VLC->terrainTypeHandler->getById(zone.getTerrainType()); const auto & terrainType = VLC->terrainTypeHandler->getById(zone.getTerrainType());