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

Random map generator refactoring (#762)

random map generator refactoring and improvements
This commit is contained in:
Nordsoft91
2022-08-09 09:54:32 +04:00
committed by Andrii Danylchenko
parent 804f1bf3f2
commit 4bd0ff680a
60 changed files with 6721 additions and 4552 deletions

View File

@@ -110,7 +110,7 @@ void CTerrainSelection::deselectRange(const MapRect & rect)
});
}
void CTerrainSelection::setSelection(std::vector<int3> & vec)
void CTerrainSelection::setSelection(const std::vector<int3> & vec)
{
for (auto pos : vec)
this->select(pos);
@@ -255,6 +255,13 @@ void CMapEditManager::drawRoad(const std::string & roadType, CRandomGenerator* g
terrainSel.clearSelection();
}
void CMapEditManager::drawRiver(const std::string & riverType, CRandomGenerator* gen)
{
execute(make_unique<CDrawRiversOperation>(map, terrainSel, riverType, gen ? gen : &(this->gen)));
terrainSel.clearSelection();
}
void CMapEditManager::insertObject(CGObjectInstance * obj)
{
@@ -818,7 +825,7 @@ CDrawTerrainOperation::ValidationResult CDrawTerrainOperation::validateTerrainVi
else
{
terType = map->getTile(currentPos).terType;
if(terType != centerTerType)
if(terType != centerTerType && (terType.isPassable() || centerTerType.isPassable()))
{
isAlien = true;
}