mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Remember "best" placement at right moment.
This commit is contained in:
parent
067b56dda4
commit
b52eeb2263
@ -204,6 +204,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)
|
||||
{
|
||||
//find most distant zone that should be attracted and move inside it
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user