Page MenuHomeWildfire Games

Escape key cancel bug ingame
Needs ReviewPublic

Authored by ffffffff on Jan 17 2018, 5:03 PM.



Atm when hitting escape in game when units selected and dialog open (barter e.g.) and menu open, u want to close menu by hit escape but u close menu, dialog and units deselected at once.

The desired effect would be only close first menu. On next escape hit close dialog. On next escape hit deselect units.

So the cancel hotkey should get a stacked order in code. First close menu if open second close a dialog if open.

The bug with deselection is only there cause we got binded same hotkey as cancel hotkey for it (escape key). So we need to check here if it binded to the same key in user config. Then it needs to be stacked at last in the cancel hotkey stack.

This code does this.

Its finished and ready to commit.

This will help patch D297 to not close selection when dialog open for info that just want to be closed on escape hit.

Test Plan

Test the described circumstance in game.

Diff Detail

Lint Skipped
Unit Tests Skipped

Event Timeline

ffffffff created this revision.Jan 17 2018, 5:03 PM
ffffffff updated this revision to Diff 5356.Jan 17 2018, 5:16 PM
ffffffff retitled this revision from Stack cancel hotkey ingame to Escape key cancel bug ingame.Jan 18 2018, 6:03 PM
ffffffff edited the summary of this revision. (Show Details)
ffffffff edited the test plan for this revision. (Show Details)
bb added a subscriber: bb.Mar 3 2018, 4:58 PM

It is true that esc should only close the uppermost dialog imo. But I guess at some point we want to have dialogs on top of eachother and that will require an radically different hotkey support (any hotkey should only effect the selected dialog). As this patch hardcodes the way we handle esc, it doesn't solve the underlying problem, and I kinda lean towards a "no" for the patch.

There is also a more generic approach for general hotkey impli in session D1248. Maybe have a look there.