Added int2.Clamp(Rectangle). All queries for map geometry use map.Bounds.

This commit is contained in:
Paul Chote
2010-11-24 12:24:48 +13:00
parent 1dfe437641
commit fc5830a687
14 changed files with 63 additions and 52 deletions

View File

@@ -90,9 +90,7 @@ namespace OpenRA
public static int2 ClampToWorld( this World world, int2 xy )
{
var b = world.Map.Bounds;
return new int2(Math.Min(b.Right, Math.Max(xy.X, b.Left)),
Math.Min(b.Bottom, Math.Max(xy.Y, b.Top)));
return xy.Clamp(world.Map.Bounds);
}
public static int2 ChooseRandomEdgeCell(this World w)