diff --git a/client/CServerHandler.cpp b/client/CServerHandler.cpp index c58408076..1df5a852a 100644 --- a/client/CServerHandler.cpp +++ b/client/CServerHandler.cpp @@ -690,7 +690,11 @@ void CServerHandler::startCampaignScenario(std::shared_ptr cs) CMM->openCampaignLobby(ourCampaign); } else + { + GH.windows().pushWindow(CMM); + GH.windows().pushWindow(CMM->menu); CMM->openCampaignScreen(ourCampaign->campaignSet); + } }; if(epilogue.hasPrologEpilog) { diff --git a/client/mainmenu/CCampaignScreen.cpp b/client/mainmenu/CCampaignScreen.cpp index f4404023d..c4ea92120 100644 --- a/client/mainmenu/CCampaignScreen.cpp +++ b/client/mainmenu/CCampaignScreen.cpp @@ -89,8 +89,8 @@ std::shared_ptr CCampaignScreen::createExitButton(const JsonNode & butt return std::make_shared(Point((int)button["x"].Float(), (int)button["y"].Float()), AnimationPath::fromJson(button["name"]), help, [=](){ close();}, EShortcut::GLOBAL_CANCEL); } -CCampaignScreen::CCampaignButton::CCampaignButton(const JsonNode & config, std::string set) - : set(set) +CCampaignScreen::CCampaignButton::CCampaignButton(const JsonNode & config, std::string campaignSet) + : campaignSet(campaignSet) { OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; @@ -135,7 +135,7 @@ void CCampaignScreen::CCampaignButton::show(Canvas & to) void CCampaignScreen::CCampaignButton::clickReleased(const Point & cursorPosition) { CCS->videoh->close(); - CMainMenu::openCampaignLobby(campFile, set); + CMainMenu::openCampaignLobby(campFile, campaignSet); } void CCampaignScreen::CCampaignButton::hover(bool on) diff --git a/client/mainmenu/CCampaignScreen.h b/client/mainmenu/CCampaignScreen.h index 4e450d7dd..c9abc2a59 100644 --- a/client/mainmenu/CCampaignScreen.h +++ b/client/mainmenu/CCampaignScreen.h @@ -40,13 +40,13 @@ private: VideoPath video; // the resource name of the video std::string hoverText; - std::string set; + std::string campaignSet; void clickReleased(const Point & cursorPosition) override; void hover(bool on) override; public: - CCampaignButton(const JsonNode & config, std::string set); + CCampaignButton(const JsonNode & config, std::string campaignSet); void show(Canvas & to) override; }; @@ -59,7 +59,7 @@ private: std::shared_ptr createExitButton(const JsonNode & button); public: - CCampaignScreen(const JsonNode & config, std::string name); + CCampaignScreen(const JsonNode & config, std::string campaignSet); void activate() override; }; diff --git a/client/mainmenu/CMainMenu.cpp b/client/mainmenu/CMainMenu.cpp index af0765360..119763fed 100644 --- a/client/mainmenu/CMainMenu.cpp +++ b/client/mainmenu/CMainMenu.cpp @@ -352,13 +352,12 @@ void CMainMenu::openLobby(ESelectionScreen screenType, bool host, const std::vec void CMainMenu::openCampaignLobby(const std::string & campaignFileName, std::string campaignSet) { auto ourCampaign = CampaignHandler::getCampaign(campaignFileName); - openCampaignLobby(ourCampaign, campaignSet); + ourCampaign->campaignSet = campaignSet; + openCampaignLobby(ourCampaign); } -void CMainMenu::openCampaignLobby(std::shared_ptr campaign, std::string campaignSet) +void CMainMenu::openCampaignLobby(std::shared_ptr campaign) { - campaign->campaignSet = campaignSet; - CSH->resetStateForLobby(StartInfo::CAMPAIGN); CSH->screenType = ESelectionScreen::campaignList; CSH->campaignStateToSend = campaign; diff --git a/client/mainmenu/CMainMenu.h b/client/mainmenu/CMainMenu.h index 562271704..f0e246c60 100644 --- a/client/mainmenu/CMainMenu.h +++ b/client/mainmenu/CMainMenu.h @@ -150,7 +150,7 @@ public: void update() override; static void openLobby(ESelectionScreen screenType, bool host, const std::vector * names, ELoadMode loadMode); static void openCampaignLobby(const std::string & campaignFileName, std::string campaignSet = ""); - static void openCampaignLobby(std::shared_ptr campaign, std::string campaignSet = ""); + static void openCampaignLobby(std::shared_ptr campaign); static void startTutorial(); void openCampaignScreen(std::string name);