mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Fixed crash due to incorrect RMG options.
This commit is contained in:
		| @@ -212,6 +212,7 @@ void CMapHandler::roadsRiverTerrainInit() | ||||
| 	} | ||||
|  | ||||
| 	// Create enough room for the whole map and its frame | ||||
|  | ||||
| 	ttiles.resize(sizes.x, frameW, frameW); | ||||
| 	for (int i=0-frameW;i<ttiles.size()-frameW;i++) | ||||
| 	{ | ||||
|   | ||||
| @@ -183,8 +183,8 @@ void CMapGenOptions::finalize(CRandomGenerator & rand) | ||||
| 	if(!mapTemplate) | ||||
| 	{ | ||||
| 		mapTemplate = getPossibleTemplate(rand); | ||||
| 		assert(mapTemplate); | ||||
| 	} | ||||
| 	assert(mapTemplate); | ||||
|  | ||||
| 	if(playerCount == RANDOM_SIZE) | ||||
| 	{ | ||||
| @@ -220,6 +220,9 @@ void CMapGenOptions::finalize(CRandomGenerator & rand) | ||||
| 		monsterStrength = static_cast<EMonsterStrength::EMonsterStrength>(rand.nextInt(EMonsterStrength::GLOBAL_WEAK, EMonsterStrength::GLOBAL_STRONG)); | ||||
| 	} | ||||
|  | ||||
| 	assert (vstd::iswithin(waterContent, EWaterContent::NONE, EWaterContent::ISLANDS)); | ||||
| 	assert (vstd::iswithin(monsterStrength, EMonsterStrength::GLOBAL_WEAK, EMonsterStrength::GLOBAL_STRONG)); | ||||
|  | ||||
| 	//rectangular maps are the future of gaming | ||||
| 	//setHeight(20); | ||||
| 	//setWidth(50); | ||||
|   | ||||
| @@ -112,15 +112,20 @@ std::unique_ptr<CMap> CMapGenerator::generate(CMapGenOptions * mapGenOptions, in | ||||
|  | ||||
| std::string CMapGenerator::getMapDescription() const | ||||
| { | ||||
| 	assert(mapGenOptions); | ||||
| 	assert(map); | ||||
|  | ||||
| 	const std::string waterContentStr[3] = { "none", "normal", "islands" }; | ||||
| 	const std::string monsterStrengthStr[3] = { "weak", "normal", "strong" }; | ||||
|  | ||||
| 	int monsterStrengthIndex = mapGenOptions->getMonsterStrength() - EMonsterStrength::GLOBAL_WEAK; //does not start from 0 | ||||
|  | ||||
|     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() % | ||||
| 		randomSeed % map->width % map->height % (map->twoLevel ? "2" : "1") % static_cast<int>(mapGenOptions->getPlayerCount()) % | ||||
| 		static_cast<int>(mapGenOptions->getCompOnlyPlayerCount()) % waterContentStr[mapGenOptions->getWaterContent()] % | ||||
|         monsterStrengthStr[mapGenOptions->getMonsterStrength()]); | ||||
| 		monsterStrengthStr[monsterStrengthIndex]); | ||||
|  | ||||
| 	for(const auto & pair : mapGenOptions->getPlayersSettings()) | ||||
| 	{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user