mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Merge branch 'vcmi/master' into 'vcmi/develop'
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include "../lib/campaign/CampaignState.h"
|
||||
#include "../lib/mapping/CMapInfo.h"
|
||||
#include "../lib/mapObjects/MiscObjects.h"
|
||||
#include "../lib/modding/ModIncompatibility.h"
|
||||
#include "../lib/rmg/CMapGenOptions.h"
|
||||
#include "../lib/filesystem/Filesystem.h"
|
||||
#include "../lib/registerTypes/RegisterTypes.h"
|
||||
@@ -542,17 +543,35 @@ void CServerHandler::sendRestartGame() const
|
||||
sendLobbyPack(endGame);
|
||||
}
|
||||
|
||||
void CServerHandler::sendStartGame(bool allowOnlyAI) const
|
||||
bool CServerHandler::validateGameStart(bool allowOnlyAI) const
|
||||
{
|
||||
try
|
||||
{
|
||||
verifyStateBeforeStart(allowOnlyAI ? true : settings["session"]["onlyai"].Bool());
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
catch(ModIncompatibility & e)
|
||||
{
|
||||
showServerError( std::string("Unable to start map! Reason: ") + e.what());
|
||||
return;
|
||||
logGlobal->warn("Incompatibility exception during start scenario: %s", e.what());
|
||||
|
||||
auto errorMsg = CGI->generaltexth->translate("vcmi.server.errors.modsIncompatibility") + '\n';
|
||||
errorMsg += e.what();
|
||||
|
||||
showServerError(errorMsg);
|
||||
return false;
|
||||
}
|
||||
catch(std::exception & e)
|
||||
{
|
||||
logGlobal->error("Exception during startScenario: %s", e.what());
|
||||
showServerError( std::string("Unable to start map! Reason: ") + e.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CServerHandler::sendStartGame(bool allowOnlyAI) const
|
||||
{
|
||||
verifyStateBeforeStart(allowOnlyAI ? true : settings["session"]["onlyai"].Bool());
|
||||
|
||||
LobbyStartGame lsg;
|
||||
if(client)
|
||||
@@ -683,7 +702,7 @@ void CServerHandler::startCampaignScenario(std::shared_ptr<CampaignState> cs)
|
||||
});
|
||||
}
|
||||
|
||||
void CServerHandler::showServerError(std::string txt) const
|
||||
void CServerHandler::showServerError(const std::string & txt) const
|
||||
{
|
||||
CInfoWindow::showInfoDialog(txt, {});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user