mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Do not crash on attempt to load campaign with unsupported maps
This commit is contained in:
parent
702fc8077d
commit
2f5bf64340
@ -72,6 +72,7 @@
|
||||
"vcmi.lobby.noUnderground" : "no underground",
|
||||
"vcmi.lobby.sortDate" : "Sorts maps by change date",
|
||||
|
||||
"vcmi.client.errors.invalidMap" : "{Invalid map or campaign}\n\nFailed to start game! Selected map or campaign might be invalid or corrupted. Reason:\n%s",
|
||||
"vcmi.client.errors.missingCampaigns" : "{Missing data files}\n\nCampaigns data files were not found! You may be using incomplete or corrupted Heroes 3 data files. Please reinstall game data.",
|
||||
"vcmi.server.errors.existingProcess" : "Another VCMI server process is running. Please terminate it before starting a new game.",
|
||||
"vcmi.server.errors.modsToEnable" : "{Following mods are required}",
|
||||
|
@ -127,11 +127,23 @@ void CLobbyScreen::toggleTab(std::shared_ptr<CIntObject> tab)
|
||||
|
||||
void CLobbyScreen::startCampaign()
|
||||
{
|
||||
if(CSH->mi)
|
||||
{
|
||||
if(!CSH->mi)
|
||||
return;
|
||||
|
||||
try {
|
||||
auto ourCampaign = CampaignHandler::getCampaign(CSH->mi->fileURI);
|
||||
CSH->setCampaignState(ourCampaign);
|
||||
}
|
||||
catch (const std::runtime_error &e)
|
||||
{
|
||||
// handle possible exception on map loading. For example campaign that contains map in unsupported format
|
||||
// for example, wog campaigns or hota campaigns without hota map support mod
|
||||
MetaString message;
|
||||
message.appendTextID("vcmi.client.errors.invalidMap");
|
||||
message.replaceRawString(e.what());
|
||||
|
||||
CInfoWindow::showInfoDialog(message.toString(), {});
|
||||
}
|
||||
}
|
||||
|
||||
void CLobbyScreen::startScenario(bool allowOnlyAI)
|
||||
|
Loading…
Reference in New Issue
Block a user