Remove PPos hacks from WorldInteractionController.

This commit is contained in:
Paul Chote
2013-09-24 18:34:26 +12:00
parent 2e0e4b0bc5
commit b100b4131c

View File

@@ -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)