Remove PPos hacks from WorldInteractionController.
This commit is contained in:
@@ -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;
|
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));
|
orders.Do(o => world.IssueOrder(o));
|
||||||
|
|
||||||
world.PlayVoiceForOrders(orders);
|
world.PlayVoiceForOrders(orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetCursor(int2 pos)
|
public override string GetCursor(int2 screenPos)
|
||||||
{
|
{
|
||||||
return Sync.CheckSyncUnchanged(world, () =>
|
return Sync.CheckSyncUnchanged(world, () =>
|
||||||
{
|
{
|
||||||
|
// Always show an arrow while selecting
|
||||||
if (SelectionBox != null)
|
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
|
var mi = new MouseInput
|
||||||
{
|
{
|
||||||
Location = pos,
|
Location = screenPos,
|
||||||
Button = Game.mouseButtonPreference.Action,
|
Button = Game.mouseButtonPreference.Action,
|
||||||
Modifiers = Game.GetModifierKeys()
|
Modifiers = Game.GetModifierKeys()
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: fix this up.
|
return world.OrderGenerator.GetCursor(world, cell, mi);
|
||||||
return world.OrderGenerator.GetCursor(world, Game.viewport.ViewToWorld(mi), mi);
|
});
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleKeyPress(KeyInput e)
|
public override bool HandleKeyPress(KeyInput e)
|
||||||
|
|||||||
Reference in New Issue
Block a user