mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Remember "best" placement at right moment.
This commit is contained in:
		| @@ -203,6 +203,14 @@ void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenera | ||||
| 			} | ||||
| 		} | ||||
| 		logGlobal->traceStream() << boost::format("Total distance between zones in this iteration: %2.2f, Worst distance/movement ratio: %3.2f") % totalDistance % maxRatio; | ||||
|  | ||||
| 		//save best solution before drastic jump | ||||
| 		if (totalDistance < bestTotalDistance) | ||||
| 		{ | ||||
| 			bestTotalDistance = totalDistance; | ||||
| 			for (auto zone : zones) | ||||
| 				bestSolution[zone.second] = zone.second->getCenter(); | ||||
| 		} | ||||
| 		 | ||||
| 		if (maxRatio > 100) | ||||
| 		{ | ||||
| @@ -231,14 +239,6 @@ void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenera | ||||
| 			logGlobal->traceStream() << boost::format("New distance %f") % targetZone->getCenter().dist2d(distantZone->getCenter()); | ||||
| 		} | ||||
|  | ||||
| 		//save best solution | ||||
| 		if (totalDistance < bestTotalDistance) | ||||
| 		{ | ||||
| 			bestTotalDistance = totalDistance; | ||||
| 			for (auto zone : zones) | ||||
| 				bestSolution[zone.second] = zone.second->getCenter(); | ||||
| 		} | ||||
|  | ||||
| 		zoneScale *= inflateModifier; //increase size of zones so they | ||||
| 	} | ||||
| 	for (auto zone : zones) //finalize zone positions | ||||
|   | ||||
		Reference in New Issue
	
	Block a user