removed needless cursor indirection

This commit is contained in:
Chris Forbes
2010-02-06 16:18:48 +13:00
parent 4724734454
commit 3b1dc39d6d
16 changed files with 47 additions and 75 deletions

View File

@@ -112,11 +112,11 @@ namespace OpenRa.Traits
public void Render( World world ) { }
public Cursor GetCursor(World world, int2 xy, MouseInput mi)
public string GetCursor(World world, int2 xy, MouseInput mi)
{
mi.Button = MouseButton.Left;
return OrderInner(world, xy, mi).Any()
? Cursor.ChronoshiftSelect : Cursor.MoveBlocked;
? "chrono-select" : "move-blocked";
}
}
@@ -153,13 +153,13 @@ namespace OpenRa.Traits
world.WorldRenderer.DrawSelectionBox(self, Color.Red, true);
}
public Cursor GetCursor(World world, int2 xy, MouseInput mi)
public string GetCursor(World world, int2 xy, MouseInput mi)
{
if (!world.LocalPlayer.Shroud.IsExplored(xy))
return Cursor.MoveBlocked;
return "move-blocked";
var movement = self.traits.GetOrDefault<IMovement>();
return (movement.CanEnterCell(xy)) ? Cursor.Chronoshift : Cursor.MoveBlocked;
return (movement.CanEnterCell(xy)) ? "chrono-target" : "move-blocked";
}
}
}

View File

@@ -59,11 +59,11 @@ namespace OpenRa.Traits
public void Render(World world) { }
public Cursor GetCursor(World world, int2 xy, MouseInput mi)
public string GetCursor(World world, int2 xy, MouseInput mi)
{
mi.Button = MouseButton.Left;
return OrderInner(world, xy, mi).Any()
? Cursor.Ability : Cursor.MoveBlocked;
? "ability" : "move-blocked";
}
}
}

View File

@@ -62,9 +62,7 @@ namespace OpenRa.Traits
IEnumerable<Order> OrderInner(World world, int2 xy, MouseInput mi)
{
if (mi.Button == MouseButton.Left)
{
yield return new Order("NuclearMissile", world.LocalPlayer.PlayerActor, xy);
}
yield break;
}
@@ -80,7 +78,7 @@ namespace OpenRa.Traits
}
public void Render(World world) { }
public Cursor GetCursor(World world, int2 xy, MouseInput mi) { return Cursor.Nuke; }
public string GetCursor(World world, int2 xy, MouseInput mi) { return "nuke"; }
}
}