mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-05 13:04:54 +02:00
Fail gracefully when file pointed by --start path doesn't exist.
This commit is contained in:
parent
e4c88d5088
commit
79f8e0ea3c
@ -296,11 +296,21 @@ int main(int argc, char** argv)
|
||||
session["autoSkip"].Bool() = vm.count("autoSkip");
|
||||
session["oneGoodAI"].Bool() = vm.count("oneGoodAI");
|
||||
|
||||
std::string fileToStartFrom; //none by default
|
||||
if(vm.count("start"))
|
||||
fileToStartFrom = vm["start"].as<std::string>();
|
||||
|
||||
if(!vm.count("start"))
|
||||
GH.curInt = CGPreGame::create(); //will set CGP pointer to itself
|
||||
if(fileToStartFrom.size() && boost::filesystem::exists(fileToStartFrom))
|
||||
startGameFromFile(fileToStartFrom); //ommit pregame and start the game using settings from fiel
|
||||
else
|
||||
startGameFromFile(vm["start"].as<std::string>());
|
||||
{
|
||||
if(fileToStartFrom.size())
|
||||
{
|
||||
tlog3 << "Warning: cannot find given file to start from (" << fileToStartFrom
|
||||
<< "). Falling back to main menu.\n";
|
||||
}
|
||||
GH.curInt = CGPreGame::create(); //will set CGP pointer to itself
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user