Fix bogus ClampToWorld behavior (allowed helicopters to fly outside map)
This commit is contained in:
@@ -74,7 +74,8 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static int2 ClampToWorld( this World world, int2 xy )
|
public static int2 ClampToWorld( this World world, int2 xy )
|
||||||
{
|
{
|
||||||
return xy.Clamp(world.Map.Bounds);
|
var r = world.Map.Bounds;
|
||||||
|
return xy.Clamp(new Rectangle(r.X,r.Y,r.Width-1, r.Height-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int2 ChooseRandomEdgeCell(this World w)
|
public static int2 ChooseRandomEdgeCell(this World w)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
|
|
||||||
if (order.OrderString == "Move")
|
if (order.OrderString == "Move")
|
||||||
{
|
{
|
||||||
var target = order.TargetLocation.Clamp(self.World.Map.Bounds);
|
var target = self.World.ClampToWorld(order.TargetLocation);
|
||||||
|
|
||||||
self.SetTargetLine(Target.FromCell(target), Color.Green);
|
self.SetTargetLine(Target.FromCell(target), Color.Green);
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
{
|
{
|
||||||
UnReserve();
|
UnReserve();
|
||||||
|
|
||||||
var target = order.TargetLocation.Clamp(self.World.Map.Bounds);
|
var target = self.World.ClampToWorld(order.TargetLocation);
|
||||||
self.SetTargetLine(Target.FromCell(target), Color.Green);
|
self.SetTargetLine(Target.FromCell(target), Color.Green);
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
self.QueueActivity(Fly.ToCell(target));
|
self.QueueActivity(Fly.ToCell(target));
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
{
|
{
|
||||||
if (order.OrderString == "Move")
|
if (order.OrderString == "Move")
|
||||||
{
|
{
|
||||||
var target = order.TargetLocation.Clamp(self.World.Map.Bounds);
|
var target = self.World.ClampToWorld(order.TargetLocation);
|
||||||
PerformMove(self, target, order.Queued && !self.IsIdle);
|
PerformMove(self, target, order.Queued && !self.IsIdle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user