Fix key up events queueing duplicate deploy/scatter/stop orders.
This commit is contained in:
@@ -207,6 +207,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
if (keyOverrides != null)
|
if (keyOverrides != null)
|
||||||
{
|
{
|
||||||
var noShiftButtons = new[] { guardButton, deployButton, attackMoveButton };
|
var noShiftButtons = new[] { guardButton, deployButton, attackMoveButton };
|
||||||
|
var keyUpButtons = new[] { guardButton, attackMoveButton };
|
||||||
keyOverrides.AddHandler(e =>
|
keyOverrides.AddHandler(e =>
|
||||||
{
|
{
|
||||||
// HACK: allow command buttons to be triggered if the shift (queue order modifier) key is held
|
// HACK: allow command buttons to be triggered if the shift (queue order modifier) key is held
|
||||||
@@ -217,11 +218,20 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
foreach (var b in noShiftButtons)
|
foreach (var b in noShiftButtons)
|
||||||
{
|
{
|
||||||
if (b != null && !b.IsDisabled() && b.Key.IsActivatedBy(eNoShift))
|
// Button is not used by this mod
|
||||||
{
|
if (b == null)
|
||||||
b.OnKeyPress(e);
|
continue;
|
||||||
return true;
|
|
||||||
}
|
// Button is not valid for this event
|
||||||
|
if (b.IsDisabled() || !b.Key.IsActivatedBy(eNoShift))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Event is not valid for this button
|
||||||
|
if (e.Event == KeyInputEvent.Up && !keyUpButtons.Contains(b))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
b.OnKeyPress(e);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user