mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix start game button for rmg without templates (#781)
This commit is contained in:
parent
b664f9a128
commit
4f1f9e3c5d
@ -131,25 +131,19 @@ void CLobbyScreen::startScenario(bool allowOnlyAI)
|
||||
CSH->sendStartGame(allowOnlyAI);
|
||||
buttonStart->block(true);
|
||||
}
|
||||
catch(ExceptionMapMissing & e)
|
||||
catch(std::exception & e)
|
||||
{
|
||||
(void)e; // unused
|
||||
}
|
||||
catch(ExceptionNoHuman & e)
|
||||
{
|
||||
(void)e; // unused
|
||||
// You must position yourself prior to starting the game.
|
||||
logGlobal->error("Exception during startScenario: %s", e.what());
|
||||
|
||||
if(std::string(e.what()) == "ExceptionNoHuman")
|
||||
CInfoWindow::showInfoDialog(std::ref(CGI->generaltexth->allTexts[530]), CInfoWindow::TCompsInfo(), PlayerColor(1));
|
||||
}
|
||||
catch(ExceptionNoTemplate & e)
|
||||
{
|
||||
(void)e; // unused
|
||||
// Could not create a random map that fits current choices.
|
||||
|
||||
if(std::string(e.what()) == "ExceptionNoTemplate")
|
||||
CInfoWindow::showInfoDialog(std::ref(CGI->generaltexth->allTexts[751]), CInfoWindow::TCompsInfo(), PlayerColor(1));
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
||||
logGlobal->error("Unknown exception");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ std::string StartInfo::getCampaignName() const
|
||||
void LobbyInfo::verifyStateBeforeStart(bool ignoreNoHuman) const
|
||||
{
|
||||
if(!mi)
|
||||
throw ExceptionMapMissing();
|
||||
throw std::domain_error("ExceptionMapMissing");
|
||||
|
||||
//there must be at least one human player before game can be started
|
||||
std::map<PlayerColor, PlayerSettings>::const_iterator i;
|
||||
@ -73,12 +73,12 @@ void LobbyInfo::verifyStateBeforeStart(bool ignoreNoHuman) const
|
||||
break;
|
||||
|
||||
if(i == si->playerInfos.cend() && !ignoreNoHuman)
|
||||
throw ExceptionNoHuman();
|
||||
throw std::domain_error("ExceptionNoHuman");
|
||||
|
||||
if(si->mapGenOptions && si->mode == StartInfo::NEW_GAME)
|
||||
{
|
||||
if(!si->mapGenOptions->checkOptions())
|
||||
throw ExceptionNoTemplate();
|
||||
throw std::domain_error("ExceptionNoTemplate");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,6 +187,3 @@ struct DLL_LINKAGE LobbyInfo : public LobbyState
|
||||
TeamID getPlayerTeamId(PlayerColor color);
|
||||
};
|
||||
|
||||
class ExceptionMapMissing : public std::exception {};
|
||||
class ExceptionNoHuman : public std::exception {};
|
||||
class ExceptionNoTemplate : public std::exception {};
|
||||
|
Loading…
Reference in New Issue
Block a user