diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index a181d3dda..0a68ec50f 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1349,7 +1349,7 @@ void CPlayerInterface::showGarrisonDialog( const CArmedInstance *up, const CGHer * is false. * @param assemble True if the artifact is to be assembled, false if it is to be disassembled. */ -void CPlayerInterface::showArtifactAssemblyDialog (ui32 artifactID, ui32 assembleTo, bool assemble, CFunctionList onYes, CFunctionList onNo) +void CPlayerInterface::showArtifactAssemblyDialog (ui32 artifactID, ui32 assembleTo, bool assemble, CFunctionList onYes, CFunctionList onNo) { const CArtifact &artifact = *CGI->arth->artifacts[artifactID]; std::string text = artifact.Description(); diff --git a/client/CPlayerInterface.h b/client/CPlayerInterface.h index cc3d36097..e2a6b3442 100644 --- a/client/CPlayerInterface.h +++ b/client/CPlayerInterface.h @@ -217,7 +217,7 @@ public: void yourTacticPhase(int distance) override; //-------------// - void showArtifactAssemblyDialog(ui32 artifactID, ui32 assembleTo, bool assemble, CFunctionList onYes, CFunctionList onNo); + void showArtifactAssemblyDialog(ui32 artifactID, ui32 assembleTo, bool assemble, CFunctionList onYes, CFunctionList onNo); void garrisonsChanged(std::vector objs); void garrisonChanged(const CGObjectInstance * obj); void heroKilled(const CGHeroInstance* hero); diff --git a/client/VCMI_client.vcxproj b/client/VCMI_client.vcxproj index ed7755694..c2c664ca3 100644 --- a/client/VCMI_client.vcxproj +++ b/client/VCMI_client.vcxproj @@ -174,6 +174,7 @@ + @@ -198,7 +199,9 @@ - + + Create + @@ -221,6 +224,7 @@ + diff --git a/client/VCMI_client.vcxproj.filters b/client/VCMI_client.vcxproj.filters index 356614736..d389ba18b 100644 --- a/client/VCMI_client.vcxproj.filters +++ b/client/VCMI_client.vcxproj.filters @@ -108,6 +108,7 @@ gui + @@ -252,5 +253,6 @@ gui + \ No newline at end of file diff --git a/client/windows/CHeroWindow.cpp b/client/windows/CHeroWindow.cpp index ebcb107cc..9ff01838f 100644 --- a/client/windows/CHeroWindow.cpp +++ b/client/windows/CHeroWindow.cpp @@ -297,7 +297,12 @@ void CHeroWindow::update(const CGHeroInstance * hero, bool redrawNeeded /*= fals void CHeroWindow::dismissCurrent() { CFunctionList ony = std::bind(&CHeroWindow::close,this); - ony += std::bind(&CCallback::dismissHero, LOCPLINT->cb.get(), curHero); + //ony += std::bind(&CCallback::dismissHero, LOCPLINT->cb.get(), curHero); //can't assign bool function to void function list :( + auto dismiss = [=]() -> void + { + LOCPLINT->cb.get()->dismissHero(curHero); + }; + ony += dismiss; LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[22], ony, 0, false); } diff --git a/client/windows/InfoWindows.cpp b/client/windows/InfoWindows.cpp index 99e7b67c6..57887e7c7 100644 --- a/client/windows/InfoWindows.cpp +++ b/client/windows/InfoWindows.cpp @@ -66,16 +66,16 @@ void CSelWindow::selectionChange(unsigned to) redraw(); } -CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperline, const std::vector &comps, const std::vector > > &Buttons, QueryID askID) +CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperline, const std::vector &comps, const std::vector > > &Buttons, QueryID askID) { OBJ_CONSTRUCTION_CAPTURING_ALL; ID = askID; - for(int i=0;i= 0) - buttons.back()->addCallback(std::bind(&CSelWindow::madeChoice,this)); - buttons[i]->addCallback(std::bind(&CInfoWindow::close,this)); //each button will close the window apart from call-defined actions + buttons.push_back(new CButton(Point(0, 0), Buttons[i].first, CButton::tooltip(), Buttons[i].second)); + if (!i && askID.getNum() >= 0) + buttons.back()->addCallback(std::bind(&CSelWindow::madeChoice, this)); + buttons[i]->addCallback(std::bind(&CInfoWindow::close, this)); //each button will close the window apart from call-defined actions } text = new CTextBox(Text, Rect(0, 0, 250, 100), 0, FONT_MEDIUM, CENTER, Colors::WHITE); @@ -83,8 +83,13 @@ CSelWindow::CSelWindow(const std::string &Text, PlayerColor player, int charperl buttons.front()->assignedKeys.insert(SDLK_RETURN); //first button - reacts on enter buttons.back()->assignedKeys.insert(SDLK_ESCAPE); //last button - reacts on escape - if(buttons.size() > 1 && askID.getNum() >= 0) //cancel button functionality - buttons.back()->addCallback(std::bind(&CCallback::selectionMade,LOCPLINT->cb.get(),0,askID)); + if (buttons.size() > 1 && askID.getNum() >= 0) //cancel button functionality + { + buttons.back()->addCallback([askID]() { + LOCPLINT->cb.get()->selectionMade(0, askID); + }); + //buttons.back()->addCallback(std::bind(&CCallback::selectionMade, LOCPLINT->cb.get(), 0, askID)); + } for(int i=0;i