added pathing debug

This commit is contained in:
Chris Forbes
2009-10-27 08:22:54 +13:00
parent 01a3fc5c62
commit ff26bd38c7
9 changed files with 107 additions and 67 deletions

View File

@@ -11,7 +11,18 @@ namespace OpenRa.Game
{
class Controller
{
public IOrderGenerator orderGenerator;
public IOrderGenerator orderGenerator;
void ApplyOrders(float2 xy, bool left)
{
var doVoice = true;
if (orderGenerator != null)
foreach (var order in orderGenerator.Order(xy.ToInt2(), left))
{
order.Apply(doVoice);
doVoice = false;
}
}
float2 dragStart, dragEnd;
public void HandleMouseInput(MouseInput mi)
@@ -21,11 +32,8 @@ namespace OpenRa.Game
if (mi.Button == MouseButtons.Left && mi.Event == MouseInputEvent.Down)
{
if (!(orderGenerator is PlaceBuilding))
dragStart = dragEnd = xy;
if (orderGenerator != null)
foreach (var order in orderGenerator.Order(xy.ToInt2(), true))
order.Apply();
dragStart = dragEnd = xy;
ApplyOrders(xy, true);
}
if (mi.Button == MouseButtons.Left && mi.Event == MouseInputEvent.Move)
@@ -51,12 +59,10 @@ namespace OpenRa.Game
/* update the cursor to reflect the thing under us - note this
* needs to also happen when the *thing* changes, so per-frame hook */
dragStart = dragEnd = xy;
}
if( mi.Button == MouseButtons.Right && mi.Event == MouseInputEvent.Down )
if( orderGenerator != null )
foreach( var order in orderGenerator.Order( xy.ToInt2(), false ) )
order.Apply();
}
if (mi.Button == MouseButtons.Right && mi.Event == MouseInputEvent.Down)
ApplyOrders(xy, false);
}
public Pair<float2, float2>? SelectionBox