directional path cost hack for smoother flows

This commit is contained in:
Chris Forbes
2010-03-29 17:43:43 +13:00
parent 4844c82051
commit 3e45ed6133

View File

@@ -102,6 +102,13 @@ namespace OpenRA
continue;
float cellCost = ((d.X * d.Y != 0) ? 1.414213563f : 1.0f) * costHere;
// directional bonuses for smoother flow!
if (((newHere.X & 1) == 0) && d.Y < 0) cellCost -= .1f;
else if (((newHere.X & 1) == 1) && d.Y > 0) cellCost -= .1f;
if (((newHere.Y & 1) == 0) && d.X < 0) cellCost -= .1f;
else if (((newHere.Y & 1) == 1) && d.X > 0) cellCost -= .1f;
float newCost = cellInfo[ p.Location.X, p.Location.Y ].MinCost + cellCost;
if( newCost >= cellInfo[ newHere.X, newHere.Y ].MinCost )