mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Fixed underground Lava terrain.
This commit is contained in:
		| @@ -553,10 +553,10 @@ void CDrawTerrainOperation::updateTerrainTypes() | ||||
|  | ||||
| 					if (putSuitableTile) | ||||
| 					{ | ||||
| 						if(!suitableTiles.empty()) | ||||
| 						{ | ||||
| 							logGlobal->debugStream() << "Clear suitables tiles."; | ||||
| 						} | ||||
| 						//if(!suitableTiles.empty()) | ||||
| 						//{ | ||||
| 						//	logGlobal->debugStream() << "Clear suitables tiles."; | ||||
| 						//} | ||||
|  | ||||
| 						invalidNativeTilesCnt = nativeTilesCntNorm; | ||||
| 						invalidForeignTilesCnt = testTile.foreignTiles.size(); | ||||
| @@ -567,9 +567,9 @@ void CDrawTerrainOperation::updateTerrainTypes() | ||||
| 					if (addToSuitableTiles) | ||||
| 					{ | ||||
| 						suitableTiles.insert(posToTest); | ||||
| 						logGlobal->debugStream() << boost::format(std::string("Found suitable tile '%s' for main tile '%s': ") + | ||||
| 								"Invalid native tiles '%i', invalid foreign tiles '%i', centerPosValid '%i'") % posToTest % centerPos % testTile.nativeTiles.size() % | ||||
| 								testTile.foreignTiles.size() % testTile.centerPosValid; | ||||
| 						//logGlobal->debugStream() << boost::format(std::string("Found suitable tile '%s' for main tile '%s': ") + | ||||
| 						//		"Invalid native tiles '%i', invalid foreign tiles '%i', centerPosValid '%i'") % posToTest % centerPos % testTile.nativeTiles.size() % | ||||
| 						//		testTile.foreignTiles.size() % testTile.centerPosValid; | ||||
| 					} | ||||
|  | ||||
| 					terrainTile.terType = formerTerType; | ||||
|   | ||||
| @@ -259,12 +259,14 @@ void CMapGenerator::fillZones() | ||||
| 	} | ||||
|  | ||||
| 	//set apriopriate free/occupied tiles, including blocked underground rock | ||||
| 	createObstaclesCommon(); | ||||
| 	createObstaclesCommon1(); | ||||
| 	//set back original terrain for underground zones | ||||
| 	for (auto it : zones) | ||||
| 		it.second->createObstacles1(this); | ||||
| 	createObstaclesCommon2(); | ||||
| 	//place actual obstacles matching zone terrain | ||||
| 	for (auto it : zones) | ||||
| 	{ | ||||
| 		it.second->createObstacles(this); | ||||
| 	} | ||||
| 		it.second->createObstacles2(this); | ||||
|  | ||||
| 	//find place for Grail | ||||
| 	if (treasureZones.empty()) | ||||
| @@ -279,10 +281,9 @@ void CMapGenerator::fillZones() | ||||
| 	logGlobal->infoStream() << "Zones filled successfully"; | ||||
| } | ||||
|  | ||||
| void CMapGenerator::createObstaclesCommon() | ||||
| void CMapGenerator::createObstaclesCommon1() | ||||
| { | ||||
| 	#define MAKE_COOL_UNDERGROUND_TUNNELS true | ||||
| 	if (map->twoLevel && MAKE_COOL_UNDERGROUND_TUNNELS) //underground | ||||
| 	if (map->twoLevel) //underground | ||||
| 	{ | ||||
| 		//negative approach - create rock tiles first, then make sure all accessible tiles have no rock | ||||
| 		std::vector<int3> rockTiles; | ||||
| @@ -300,24 +301,13 @@ void CMapGenerator::createObstaclesCommon() | ||||
| 		} | ||||
| 		editManager->getTerrainSelection().setSelection(rockTiles); | ||||
| 		editManager->drawTerrain(ETerrainType::ROCK, &rand); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| 		//now make sure all accessible tiles have no additional rock on them | ||||
|  | ||||
| 		std::vector<int3> accessibleTiles; | ||||
| 		for (int x = 0; x < map->width; x++) | ||||
| 		{ | ||||
| 			for (int y = 0; y < map->height; y++) | ||||
| 			{ | ||||
| 				int3 tile(x, y, 1); | ||||
| 				if (isFree(tile) || isUsed(tile)) | ||||
| 				{ | ||||
| 					accessibleTiles.push_back(tile); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		editManager->getTerrainSelection().setSelection(accessibleTiles); | ||||
| 		editManager->drawTerrain(ETerrainType::SUBTERRANEAN, &rand); | ||||
|  | ||||
| void CMapGenerator::createObstaclesCommon2() | ||||
| { | ||||
| 	if (map->twoLevel) | ||||
| 	{ | ||||
| 		//finally mark rock tiles as occupied, spawn no obstacles there | ||||
| 		for (int x = 0; x < map->width; x++) | ||||
| 		{ | ||||
|   | ||||
| @@ -110,6 +110,7 @@ private: | ||||
| 	void initTiles(); | ||||
| 	void genZones(); | ||||
| 	void fillZones(); | ||||
| 	void createObstaclesCommon(); | ||||
| 	void createObstaclesCommon1(); | ||||
| 	void createObstaclesCommon2(); | ||||
|  | ||||
| }; | ||||
|   | ||||
| @@ -1337,7 +1337,26 @@ void CRmgTemplateZone::createTreasures(CMapGenerator* gen) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CRmgTemplateZone::createObstacles(CMapGenerator* gen) | ||||
| void CRmgTemplateZone::createObstacles1(CMapGenerator * gen) | ||||
| { | ||||
| 	if (pos.z) //underground | ||||
| 	{ | ||||
| 		//now make sure all accessible tiles have no additional rock on them | ||||
|  | ||||
| 		std::vector<int3> accessibleTiles; | ||||
| 		for (auto tile : tileinfo) | ||||
| 		{ | ||||
| 			if (gen->isFree(tile) || gen->isUsed(tile)) | ||||
| 			{ | ||||
| 				accessibleTiles.push_back(tile); | ||||
| 			} | ||||
| 		} | ||||
| 		gen->editManager->getTerrainSelection().setSelection(accessibleTiles); | ||||
| 		gen->editManager->drawTerrain(terrainType, &gen->rand); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| void CRmgTemplateZone::createObstacles2(CMapGenerator* gen) | ||||
| { | ||||
|  | ||||
| 	typedef std::vector<ObjectTemplate> obstacleVector; | ||||
|   | ||||
| @@ -164,7 +164,8 @@ public: | ||||
| 	void fractalize(CMapGenerator* gen); | ||||
| 	bool createRequiredObjects(CMapGenerator* gen); | ||||
| 	void createTreasures(CMapGenerator* gen); | ||||
| 	void createObstacles(CMapGenerator* gen); | ||||
| 	void createObstacles1(CMapGenerator* gen); | ||||
| 	void createObstacles2(CMapGenerator* gen); | ||||
| 	bool crunchPath (CMapGenerator* gen, const int3 &src, const int3 &dst, TRmgTemplateZoneId zone, std::set<int3>* clearedTiles = nullptr); | ||||
| 	std::vector<int3> getAccessibleOffsets (CMapGenerator* gen, CGObjectInstance* object); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user