فهرست منبع

Generate underground tunnels first to get a bit more of them.

DjWarmonger 10 سال پیش
والد
کامیت
9515d51bd2
1فایلهای تغییر یافته به همراه38 افزوده شده و 38 حذف شده
  1. 38 38
      lib/rmg/CMapGenerator.cpp

+ 38 - 38
lib/rmg/CMapGenerator.cpp

@@ -281,6 +281,44 @@ void CMapGenerator::fillZones()
 
 void CMapGenerator::createObstaclesCommon()
 {
+#define MAKE_COOL_UNDERGROUND_TUNNELS true
+	if (map->twoLevel && MAKE_COOL_UNDERGROUND_TUNNELS) //underground
+	{
+		std::vector<int3> rockTiles;
+
+		for (int x = 0; x < map->width; x++)
+		{
+			for (int y = 0; y < map->height; y++)
+			{
+				int3 tile(x, y, 1);
+				if (shouldBeBlocked(tile))
+				{
+					bool placeRock = true;
+					foreach_neighbour(tile, [this, tile, &placeRock](int3 &pos)
+					{
+						if (!(this->shouldBeBlocked(pos) || this->isPossible(pos)))
+							placeRock = false;
+					});
+					if (placeRock)
+					{
+						rockTiles.push_back(tile);
+					}
+				}
+			}
+		}
+		editManager->getTerrainSelection().setSelection(rockTiles);
+		editManager->drawTerrain(ETerrainType::ROCK, &rand);
+		for (auto tile : rockTiles)
+		{
+			setOccupied(tile, ETileType::USED); //don't place obstacles in a rock
+			//gen->foreach_neighbour (tile, [gen](int3 &pos)
+			//{
+			//	if (!gen->isUsed(pos))
+			//		gen->setOccupied (pos, ETileType::BLOCKED);
+			//});
+		}
+	}
+
 	//tighten obstacles to improve visuals
 
 	for (int i = 0; i < 3; ++i)
@@ -322,44 +360,6 @@ void CMapGenerator::createObstaclesCommon()
 		}
 		logGlobal->traceStream() << boost::format("Set %d tiles to BLOCKED and %d tiles to FREE") % blockedTiles % freeTiles;
 	}
-
-	#define MAKE_COOL_UNDERGROUND_TUNNELS true
-	if (map->twoLevel && MAKE_COOL_UNDERGROUND_TUNNELS) //underground
-	{
-		std::vector<int3> rockTiles;
-
-		for (int x = 0; x < map->width; x++)
-		{
-			for (int y = 0; y < map->height; y++)
-			{
-				int3 tile(x, y, 1);
-				if (shouldBeBlocked(tile))
-				{
-					bool placeRock = true;
-					foreach_neighbour(tile, [this, &placeRock](int3 &pos)
-					{
-						if (!(this->shouldBeBlocked(pos) || this->isPossible(pos)))
-							placeRock = false;
-					});
-					if (placeRock)
-					{
-						rockTiles.push_back(tile);
-					}
-				}
-			}
-		}
-		editManager->getTerrainSelection().setSelection(rockTiles);
-		editManager->drawTerrain(ETerrainType::ROCK, &rand);
-		for (auto tile : rockTiles)
-		{
-			setOccupied(tile, ETileType::USED); //don't place obstacles in a rock
-			//gen->foreach_neighbour (tile, [gen](int3 &pos)
-			//{
-			//	if (!gen->isUsed(pos))
-			//		gen->setOccupied (pos, ETileType::BLOCKED);
-			//});
-		}
-	}
 }
 
 void CMapGenerator::findZonesForQuestArts()