Browse Source

Fix keyboard shortcuts on selection dialogs

Ivan Savenko 2 years ago
parent
commit
01d588ab54
1 changed files with 9 additions and 0 deletions
  1. 9 0
      client/windows/InfoWindows.cpp

+ 9 - 0
client/windows/InfoWindows.cpp

@@ -90,6 +90,15 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl
 		//buttons.back()->addCallback(std::bind(&CCallback::selectionMade, LOCPLINT->cb.get(), 0, askID));
 	}
 
+	if(buttons.size() == 1)
+		buttons.front()->assignedKey = EShortcut::GLOBAL_RETURN;
+
+	if(buttons.size() == 2)
+	{
+		buttons.front()->assignedKey = EShortcut::GLOBAL_ACCEPT;
+		buttons.back()->assignedKey = EShortcut::GLOBAL_CANCEL;
+	}
+
 	for(int i=0;i<comps.size();i++)
 	{
 		comps[i]->recActions = 255-DISPOSE;