Show whole topic Oct 08, 2016 7:59 am
mdooligan Offline
Approved Member
Registered since: Dec 07, 2008
Location: Vancouver BC


Subject: Re: HUD hotkeys do not work?
Update: when you select a unit, the hud hotkeys are deactivated.

src/ui/graphical/game/gamegui.cpp:186
DownloadSource code (Text):
  1.                 if (gameMap->getUnitSelection().getSelectedUnit() == nullptr)
  2.                 {
  3.                         hud->activateShortcuts();
  4.                 }
  5.                 else
  6.                 {
  7.                         //hud->deactivateShortcuts();
  8.                 }

So I commented the line out and my hud hotkeys go back to working. I'm guessing this was done because some of the unit hotkeys overlap the hud hotkeys, but it certainly isn't obvious that this would be the case. In the original, the number keys 1-0 are used for the unit menu actions.

To quote the original readme.txt from ca.1995:
DownloadSource code (Text):
  1.    Hot keys for unit commands:
  2.  
  3.    Press 1 (or the first letter of the word) for these functions:
  4.    ...Activate
  5.    ...Allocate
  6.    ...Auto-Survey
  7.    ...Build
  8.    ...Buy Upgrade
  9.    ...Disable
  10.    ...Place Mines
  11.    ...Reload
  12.    ...Repair
  13.    ...Research
  14.  
  15.    Press 2 (or the first letter of the word) for these functions:
  16.    ...Load
  17.    ...Start
  18.    ...Steal
  19.  
  20.    Press 3 (or the first letter of the word) for these functions:
  21.    ...Attack
  22.    ...Transfer
  23.  
  24.    Press 4 (or the first letter of the word) for the Manual function.
  25.  
  26.    Press 5 (or the first letter of the word) for these functions:
  27.    ...Enter
  28.    ...Upgrade
  29.    
  30.    Press 6 (or the first letter of the word) for the Upgrade All function.
  31.  
  32.    Press 7 (or the first letter of the word) for the Stop function.
  33.  
  34.    Press 8 (or the first letter of the word) for the Sentry function.
  35.  
  36.    Press 9 (or the first letter of the word) for the Done function.
  37.  
  38.    Press 0 (or the first letter of the word) for the Remove function.


Then I notice my keyCenterUnit is not working. I tracked that down to

src/ui/graphical/game/hud.cpp:106

where I inserted the line
DownloadSource code (Text):
  1.         auto centerButton = addChild (std::make_unique<cPushButton> (cPosition (4, 227), ePushButtonType::HudCenter));
  2.         /* oops, callback missing... */
  3.         centerButton->addClickShortcut (KeysList.keyCenterUnit);
  4.         signalConnectionManager.connect (centerButton->clicked, [&]() { centerClicked(); });
and now I can center the unit with the 'f' key. I guess nobody uses that key? How it got missed in the rush I don't know.
Miven Dooligan
Peace and cheer