mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Simplified target function comparison.
This commit is contained in:
@@ -445,14 +445,9 @@ void CZonePlacer::placeZones(CRandomGenerator * rand)
|
||||
|
||||
//check fitness function
|
||||
bool improvement = false;
|
||||
if (bestTotalDistance > 0 && bestTotalOverlap > 0)
|
||||
if ((totalDistance + 1) * (totalOverlap + 1) < (bestTotalDistance + 1) * (bestTotalOverlap + 1))
|
||||
{
|
||||
if (totalDistance * totalOverlap < bestTotalDistance * bestTotalOverlap) //multiplication is better for auto-scaling, but stops working if one factor is 0
|
||||
improvement = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (totalDistance + totalOverlap < bestTotalDistance + bestTotalOverlap)
|
||||
//multiplication is better for auto-scaling, but stops working if one factor is 0
|
||||
improvement = true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user