1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Implemented configurable level of decorations for terrains

This commit is contained in:
Ivan Savenko
2023-12-22 17:41:30 +02:00
parent 4ed283a357
commit 19e851ddff
11 changed files with 37 additions and 20 deletions

View File

@@ -45,6 +45,11 @@ RmgMap::RmgMap(const CMapGenOptions& mapGenOptions) :
getEditManager()->getUndoManager().setUndoRedoLimit(0);
}
int RmgMap::getDecorationsPercentage() const
{
return 10; // arbitrary value to generate more readable map
}
void RmgMap::foreach_neighbour(const int3 & pos, const std::function<void(int3 & pos)> & foo) const
{
for(const int3 &dir : int3::getDirs())
@@ -90,7 +95,7 @@ void RmgMap::initTiles(CMapGenerator & generator, CRandomGenerator & rand)
getEditManager()->clearTerrain(&rand);
getEditManager()->getTerrainSelection().selectRange(MapRect(int3(0, 0, 0), mapGenOptions.getWidth(), mapGenOptions.getHeight()));
getEditManager()->drawTerrain(ETerrainId::GRASS, &rand);
getEditManager()->drawTerrain(ETerrainId::GRASS, getDecorationsPercentage(), &rand);
const auto * tmpl = mapGenOptions.getMapTemplate();
zones.clear();