From b100b4131c5f1729f120b356741220a138a0a156 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 24 Sep 2013 18:34:26 +1200 Subject: [PATCH] Remove PPos hacks from WorldInteractionController. --- .../WorldInteractionControllerWidget.cs | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 4d122e5ebc..407fff9394 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -136,33 +136,38 @@ namespace OpenRA.Widgets } } - public void ApplyOrders(World world, int2 xy, MouseInput mi) + void ApplyOrders(World world, int2 xy, MouseInput mi) { if (world.OrderGenerator == null) return; - var orders = world.OrderGenerator.Order(world, ((PPos)xy).ToCPos(), mi).ToArray(); + var pos = worldRenderer.Position(xy); + var orders = world.OrderGenerator.Order(world, pos.ToCPos(), mi).ToArray(); orders.Do(o => world.IssueOrder(o)); world.PlayVoiceForOrders(orders); } - public override string GetCursor(int2 pos) + public override string GetCursor(int2 screenPos) { return Sync.CheckSyncUnchanged(world, () => { + // Always show an arrow while selecting if (SelectionBox != null) - return null; /* always show an arrow while selecting */ + return null; + + var xy = Game.viewport.ViewToWorldPx(screenPos); + var pos = worldRenderer.Position(xy); + var cell = pos.ToCPos(); var mi = new MouseInput { - Location = pos, + Location = screenPos, Button = Game.mouseButtonPreference.Action, Modifiers = Game.GetModifierKeys() }; - // TODO: fix this up. - return world.OrderGenerator.GetCursor(world, Game.viewport.ViewToWorld(mi), mi); - } ); + return world.OrderGenerator.GetCursor(world, cell, mi); + }); } public override bool HandleKeyPress(KeyInput e)