mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix "Start game" blocking status:
- Start game is now initially blocked - Receiving valid startInfo from server will unlock button
This commit is contained in:
@@ -88,6 +88,8 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
|
||||
break;
|
||||
}
|
||||
|
||||
buttonStart->block(true); // to be unblocked after map list is ready
|
||||
|
||||
buttonBack = std::make_shared<CButton>(Point(581, 535), "SCNRBACK.DEF", CGI->generaltexth->zelp[105], [&]()
|
||||
{
|
||||
CSH->sendClientDisconnecting();
|
||||
@@ -126,34 +128,11 @@ void CLobbyScreen::startCampaign()
|
||||
|
||||
void CLobbyScreen::startScenario(bool allowOnlyAI)
|
||||
{
|
||||
try
|
||||
if (CSH->validateGameStart(allowOnlyAI))
|
||||
{
|
||||
CSH->sendStartGame(allowOnlyAI);
|
||||
buttonStart->block(true);
|
||||
}
|
||||
catch(CModHandler::Incompatibility & e)
|
||||
{
|
||||
logGlobal->warn("Incompatibility exception during start scenario: %s", e.what());
|
||||
|
||||
auto errorMsg = CGI->generaltexth->translate("vcmi.server.errors.modsIncompatibility") + '\n';
|
||||
errorMsg += e.what();
|
||||
|
||||
CInfoWindow::showInfoDialog(errorMsg, CInfoWindow::TCompsInfo(), PlayerColor(1));
|
||||
}
|
||||
catch(std::exception & e)
|
||||
{
|
||||
logGlobal->error("Exception during startScenario: %s", e.what());
|
||||
|
||||
if(std::string(e.what()) == "ExceptionNoHuman")
|
||||
CInfoWindow::showInfoDialog(CGI->generaltexth->allTexts[530], CInfoWindow::TCompsInfo(), PlayerColor(1));
|
||||
|
||||
if(std::string(e.what()) == "ExceptionNoTemplate")
|
||||
CInfoWindow::showInfoDialog(CGI->generaltexth->allTexts[751], CInfoWindow::TCompsInfo(), PlayerColor(1));
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
logGlobal->error("Unknown exception");
|
||||
}
|
||||
}
|
||||
|
||||
void CLobbyScreen::toggleMode(bool host)
|
||||
@@ -192,6 +171,8 @@ void CLobbyScreen::updateAfterStateChange()
|
||||
if(CSH->mi && tabOpt)
|
||||
tabOpt->recreate();
|
||||
|
||||
buttonStart->block(CSH->mi == nullptr || CSH->isGuest());
|
||||
|
||||
card->changeSelection();
|
||||
if (card->iconDifficulty)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user