diff --git a/lib/GameConstants.h b/lib/GameConstants.h index 7319562f9..69a860ccc 100644 --- a/lib/GameConstants.h +++ b/lib/GameConstants.h @@ -482,6 +482,23 @@ enum class ETeleportChannelType MIXED }; + +namespace ERiverType +{ + enum ERiverType + { + NO_RIVER, CLEAR_RIVER, ICY_RIVER, MUDDY_RIVER, LAVA_RIVER + }; +} + +namespace ERoadType +{ + enum ERoadType + { + NO_ROAD, DIRT_ROAD, GRAVEL_ROAD, COBBLESTONE_ROAD + }; +} + class Obj { public: diff --git a/lib/mapping/CMap.h b/lib/mapping/CMap.h index 906867152..2447789cb 100644 --- a/lib/mapping/CMap.h +++ b/lib/mapping/CMap.h @@ -261,22 +261,6 @@ public: } }; -namespace ERiverType -{ -enum ERiverType -{ - NO_RIVER, CLEAR_RIVER, ICY_RIVER, MUDDY_RIVER, LAVA_RIVER -}; -} - -namespace ERoadType -{ -enum ERoadType -{ - NO_ROAD, DIRT_ROAD, GRAVEL_ROAD, COBBLESTONE_ROAD -}; -} - /// The terrain tile describes the terrain type and the visual representation of the terrain. /// Furthermore the struct defines whether the tile is visitable or/and blocked and which objects reside in it. struct DLL_LINKAGE TerrainTile diff --git a/lib/rmg/CMapGenerator.cpp b/lib/rmg/CMapGenerator.cpp index f67e82180..36e931505 100644 --- a/lib/rmg/CMapGenerator.cpp +++ b/lib/rmg/CMapGenerator.cpp @@ -132,7 +132,7 @@ std::string CMapGenerator::getMapDescription() const std::stringstream ss; ss << boost::str(boost::format(std::string("Map created by the Random Map Generator.\nTemplate was %s, Random seed was %d, size %dx%d") + - ", levels %s, humans %d, computers %d, water %s, monster %s, second expansion map") % mapGenOptions->getMapTemplate()->getName() % + ", levels %s, humans %d, computers %d, water %s, monster %s, VCMI map") % mapGenOptions->getMapTemplate()->getName() % randomSeed % map->width % map->height % (map->twoLevel ? "2" : "1") % static_cast(mapGenOptions->getPlayerCount()) % static_cast(mapGenOptions->getCompOnlyPlayerCount()) % waterContentStr[mapGenOptions->getWaterContent()] % monsterStrengthStr[monsterStrengthIndex]); diff --git a/lib/rmg/CRmgTemplateZone.cpp b/lib/rmg/CRmgTemplateZone.cpp index bf6e3de51..5220113bd 100644 --- a/lib/rmg/CRmgTemplateZone.cpp +++ b/lib/rmg/CRmgTemplateZone.cpp @@ -81,7 +81,7 @@ void CRmgTemplateZone::CTownInfo::setCastleDensity(int value) castleDensity = value; } -CTileInfo::CTileInfo():nearestObjectDistance(INT_MAX), terrain(ETerrainType::WRONG) +CTileInfo::CTileInfo():nearestObjectDistance(INT_MAX), terrain(ETerrainType::WRONG),roadType(ERoadType::NO_ROAD) { occupied = ETileType::POSSIBLE; //all tiles are initially possible to place objects or passages } @@ -135,6 +135,13 @@ void CTileInfo::setTerrainType(ETerrainType value) terrain = value; } +void CTileInfo::setRoadType(ERoadType::ERoadType value) +{ + roadType = value; +// setOccupied(ETileType::FREE); +} + + CRmgTemplateZone::CRmgTemplateZone() : id(0), type(ETemplateZoneType::PLAYER_START), @@ -1424,6 +1431,19 @@ void CRmgTemplateZone::createObstacles2(CMapGenerator* gen) } } +void CRmgTemplateZone::drawRoads(CMapGenerator* gen) +{ + std::vector tiles; + for (auto tile : freePaths) + { + tiles.push_back (tile); + } + gen->editManager->getTerrainSelection().setSelection(tiles); + gen->editManager->drawRoad(ERoadType::COBBLESTONE_ROAD, &gen->rand); +} + + + bool CRmgTemplateZone::fill(CMapGenerator* gen) { initTerrainType(gen); @@ -1436,7 +1456,9 @@ bool CRmgTemplateZone::fill(CMapGenerator* gen) createRequiredObjects(gen); fractalize(gen); //after required objects are created and linked with their own paths createTreasures(gen); - + + drawRoads(gen); + logGlobal->infoStream() << boost::format ("Zone %d filled successfully") %id; return true; } diff --git a/lib/rmg/CRmgTemplateZone.h b/lib/rmg/CRmgTemplateZone.h index 314347eb2..d1a16a407 100644 --- a/lib/rmg/CRmgTemplateZone.h +++ b/lib/rmg/CRmgTemplateZone.h @@ -51,11 +51,12 @@ public: ETerrainType getTerrainType() const; ETileType::ETileType getTileType() const; void setTerrainType(ETerrainType value); - + void setRoadType(ERoadType::ERoadType value); private: float nearestObjectDistance; ETileType::ETileType occupied; ETerrainType terrain; + ERoadType::ERoadType roadType; }; class DLL_LINKAGE CTreasureInfo @@ -215,6 +216,8 @@ private: std::set possibleTiles; //optimization purposes for treasure generation std::vector connections; //list of adjacent zones std::set freePaths; //core paths of free tiles that all other objects will be linked to + + void drawRoads(CMapGenerator* gen); bool pointIsIn(int x, int y); void addAllPossibleObjects (CMapGenerator* gen); //add objects, including zone-specific, to possibleObjects