mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fixed single map victory crash
This commit is contained in:
parent
ec536e613c
commit
97869fc36f
@ -2467,12 +2467,16 @@ void CPlayerInterface::showShipyardDialogOrProblemPopup(const IShipyard *obj)
|
|||||||
|
|
||||||
void CPlayerInterface::requestReturningToMainMenu(bool won)
|
void CPlayerInterface::requestReturningToMainMenu(bool won)
|
||||||
{
|
{
|
||||||
CSH->state = EClientState::DISCONNECTING;
|
|
||||||
CCS->soundh->ambientStopAllChannels();
|
CCS->soundh->ambientStopAllChannels();
|
||||||
if(won && cb->getStartInfo()->campState)
|
if(won && cb->getStartInfo()->campState)
|
||||||
|
{
|
||||||
|
CSH->state = EClientState::DISCONNECTING; // do not close server, it's not intended for campaign continuation
|
||||||
CSH->startCampaignScenario(cb->getStartInfo()->campState);
|
CSH->startCampaignScenario(cb->getStartInfo()->campState);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sendCustomEvent(EUserEvent::RETURN_TO_MAIN_MENU);
|
sendCustomEvent(EUserEvent::RETURN_TO_MAIN_MENU);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayerInterface::sendCustomEvent( int code )
|
void CPlayerInterface::sendCustomEvent( int code )
|
||||||
|
@ -495,6 +495,7 @@ void CServerHandler::endGameplay(bool closeConnection, bool restart)
|
|||||||
{
|
{
|
||||||
if(CMM)
|
if(CMM)
|
||||||
{
|
{
|
||||||
|
GH.terminate_cond->setn(false);
|
||||||
GH.curInt = CMM.get();
|
GH.curInt = CMM.get();
|
||||||
CMM->enable();
|
CMM->enable();
|
||||||
}
|
}
|
||||||
@ -644,6 +645,7 @@ void CServerHandler::threadHandleConnection()
|
|||||||
logNetwork->error(e.what());
|
logNetwork->error(e.what());
|
||||||
if(client)
|
if(client)
|
||||||
{
|
{
|
||||||
|
state = EClientState::DISCONNECTING;
|
||||||
CGuiHandler::pushSDLEvent(SDL_USEREVENT, EUserEvent::RETURN_TO_MAIN_MENU);
|
CGuiHandler::pushSDLEvent(SDL_USEREVENT, EUserEvent::RETURN_TO_MAIN_MENU);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -352,7 +352,7 @@ std::shared_ptr<CMainMenu> CMainMenu::create()
|
|||||||
if(!CMM)
|
if(!CMM)
|
||||||
CMM = std::shared_ptr<CMainMenu>(new CMainMenu());
|
CMM = std::shared_ptr<CMainMenu>(new CMainMenu());
|
||||||
|
|
||||||
GH.terminate_cond->set(false);
|
GH.terminate_cond->setn(false);
|
||||||
return CMM;
|
return CMM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +191,8 @@ void CVCMIServer::run()
|
|||||||
{
|
{
|
||||||
gh->run(si->mode == StartInfo::LOAD_GAME);
|
gh->run(si->mode == StartInfo::LOAD_GAME);
|
||||||
}
|
}
|
||||||
|
while(state == EServerState::GAMEPLAY_ENDED)
|
||||||
|
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVCMIServer::threadAnnounceLobby()
|
void CVCMIServer::threadAnnounceLobby()
|
||||||
|
Loading…
Reference in New Issue
Block a user