From 39838fdd3c8b292425318e7a98f7844411718cce Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:26:11 +0200 Subject: [PATCH] extend for all selections --- client/windows/InfoWindows.cpp | 7 +++++++ client/windows/InfoWindows.h | 1 + 2 files changed, 8 insertions(+) diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index 2ae2ad3fb..f015c779b 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -106,6 +106,7 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl addChild(comps[i].get()); components.push_back(comps[i]); comps[i]->onSelect = std::bind(&CSelWindow::selectionChange,this,i); + comps[i]->onChoose = std::bind(&CSelWindow::madeChoiceAndClose,this); if(i<8) comps[i]->assignedKey = vstd::next(EShortcut::SELECT_INDEX_1,i); } @@ -127,6 +128,12 @@ void CSelWindow::madeChoice() LOCPLINT->cb->selectionMade(ret+1,ID); } +void CSelWindow::madeChoiceAndClose() +{ + madeChoice(); + close(); +} + CInfoWindow::CInfoWindow(std::string Text, PlayerColor player, const TCompsInfo & comps, const TButtonsInfo & Buttons) { OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE); diff --git a/client/windows/InfoWindows.h b/client/windows/InfoWindows.h index ea91777cf..ff6b880da 100644 --- a/client/windows/InfoWindows.h +++ b/client/windows/InfoWindows.h @@ -130,6 +130,7 @@ class CSelWindow : public CInfoWindow public: void selectionChange(unsigned to); void madeChoice(); //looks for selected component and calls callback + void madeChoiceAndClose(); CSelWindow(const std::string & text, PlayerColor player, int charperline, const std::vector> & comps, const std::vector > > &Buttons, QueryID askID); //notification - this class inherits important destructor from CInfoWindow