1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

get back to campaignmenu

This commit is contained in:
Laserlicht 2023-09-20 21:18:13 +02:00 committed by GitHub
parent 34182069f5
commit 52b86eb9c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 11 deletions

View File

@ -690,7 +690,11 @@ void CServerHandler::startCampaignScenario(std::shared_ptr<CampaignState> cs)
CMM->openCampaignLobby(ourCampaign);
}
else
{
GH.windows().pushWindow(CMM);
GH.windows().pushWindow(CMM->menu);
CMM->openCampaignScreen(ourCampaign->campaignSet);
}
};
if(epilogue.hasPrologEpilog)
{

View File

@ -89,8 +89,8 @@ std::shared_ptr<CButton> CCampaignScreen::createExitButton(const JsonNode & butt
return std::make_shared<CButton>(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)

View File

@ -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<CButton> createExitButton(const JsonNode & button);
public:
CCampaignScreen(const JsonNode & config, std::string name);
CCampaignScreen(const JsonNode & config, std::string campaignSet);
void activate() override;
};

View File

@ -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<CampaignState> campaign, std::string campaignSet)
void CMainMenu::openCampaignLobby(std::shared_ptr<CampaignState> campaign)
{
campaign->campaignSet = campaignSet;
CSH->resetStateForLobby(StartInfo::CAMPAIGN);
CSH->screenType = ESelectionScreen::campaignList;
CSH->campaignStateToSend = campaign;

View File

@ -150,7 +150,7 @@ public:
void update() override;
static void openLobby(ESelectionScreen screenType, bool host, const std::vector<std::string> * names, ELoadMode loadMode);
static void openCampaignLobby(const std::string & campaignFileName, std::string campaignSet = "");
static void openCampaignLobby(std::shared_ptr<CampaignState> campaign, std::string campaignSet = "");
static void openCampaignLobby(std::shared_ptr<CampaignState> campaign);
static void startTutorial();
void openCampaignScreen(std::string name);