Add squad and quantisation support to AirstrikePower.

This commit is contained in:
Paul Chote
2013-10-31 21:30:57 +13:00
parent f1f032dbb8
commit d7effe71da
3 changed files with 56 additions and 32 deletions

View File

@@ -124,13 +124,13 @@ namespace OpenRA
r.Next(w.Map.Bounds.Top, w.Map.Bounds.Bottom));
}
public static WPos FindMapEdge(this World w, WPos pos, WVec dir)
public static WRange DistanceToMapEdge(this World w, WPos pos, WVec dir)
{
var tl = w.Map.Bounds.TopLeftAsCPos().TopLeft;
var br = w.Map.Bounds.BottomRightAsCPos().BottomRight;
var x = dir.X == 0 ? int.MaxValue : ((dir.X < 0 ? tl.X : br.X) - pos.X) / dir.X;
var y = dir.Y == 0 ? int.MaxValue : ((dir.Y < 0 ? tl.Y : br.Y) - pos.Y) / dir.Y;
return pos + Math.Min(x, y) * dir;
return new WRange(Math.Min(x, y) * dir.Length);
}
public static bool HasVoices(this Actor a)