mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Do not create main menu UI for game restart (#462)
This commit is contained in:
@@ -478,7 +478,7 @@ void CServerHandler::startGameplay()
|
|||||||
state = EClientState::GAMEPLAY;
|
state = EClientState::GAMEPLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServerHandler::endGameplay(bool closeConnection)
|
void CServerHandler::endGameplay(bool closeConnection, bool restart)
|
||||||
{
|
{
|
||||||
client->endGame();
|
client->endGame();
|
||||||
vstd::clear_pointer(client);
|
vstd::clear_pointer(client);
|
||||||
@@ -490,14 +490,17 @@ void CServerHandler::endGameplay(bool closeConnection)
|
|||||||
CSH->sendClientDisconnecting();
|
CSH->sendClientDisconnecting();
|
||||||
logNetwork->info("Closed connection.");
|
logNetwork->info("Closed connection.");
|
||||||
}
|
}
|
||||||
if(CMM)
|
if(!restart)
|
||||||
{
|
{
|
||||||
GH.curInt = CMM;
|
if(CMM)
|
||||||
CMM->enable();
|
{
|
||||||
}
|
GH.curInt = CMM;
|
||||||
else
|
CMM->enable();
|
||||||
{
|
}
|
||||||
GH.curInt = CMainMenu::create();
|
else
|
||||||
|
{
|
||||||
|
GH.curInt = CMainMenu::create();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public:
|
|||||||
void sendStartGame(bool allowOnlyAI = false) const override;
|
void sendStartGame(bool allowOnlyAI = false) const override;
|
||||||
|
|
||||||
void startGameplay();
|
void startGameplay();
|
||||||
void endGameplay(bool closeConnection = true);
|
void endGameplay(bool closeConnection = true, bool restart = false);
|
||||||
void startCampaignScenario(std::shared_ptr<CCampaignState> cs = {});
|
void startCampaignScenario(std::shared_ptr<CCampaignState> cs = {});
|
||||||
|
|
||||||
// TODO: LobbyState must be updated within game so we should always know how many player interfaces our client handle
|
// TODO: LobbyState must be updated within game so we should always know how many player interfaces our client handle
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ bool LobbyStartGame::applyOnLobbyHandler(CServerHandler * handler)
|
|||||||
{
|
{
|
||||||
if(handler->state == EClientState::GAMEPLAY)
|
if(handler->state == EClientState::GAMEPLAY)
|
||||||
{
|
{
|
||||||
handler->endGameplay(false);
|
handler->endGameplay(false, true);
|
||||||
}
|
}
|
||||||
handler->state = EClientState::STARTING;
|
handler->state = EClientState::STARTING;
|
||||||
if(handler->si->mode != StartInfo::LOAD_GAME)
|
if(handler->si->mode != StartInfo::LOAD_GAME)
|
||||||
|
|||||||
Reference in New Issue
Block a user