- check if a map file exists before starting it.

This commit is contained in:
Christoph Oelckers 2020-09-04 20:47:40 +02:00
parent 97f395bd72
commit 3eef0db6f6
2 changed files with 15 additions and 3 deletions

View file

@ -242,6 +242,7 @@ void StartLevel(MapRecord* level)
paused = 0;
levelTryPlayMusic();
gChoke.reset();
Printf(TEXTCOLOR_GOLD "%s: %s\n", level->LabelName(), level->DisplayName());
}

View file

@ -282,6 +282,10 @@ static MapRecord* levelwarp_common(FCommandLine& argv, const char *cmdname, cons
else Printf(PRINT_BOLD, "Level %s not found!\n", argv[1]);
return nullptr;
}
if (fileSystem.FindFile(map->fileName) < 0)
{
Printf(PRINT_BOLD, "%s: map file not found\n", map->fileName.GetChars());
}
return map;
}
@ -363,9 +367,6 @@ CCMD(changemap)
#endif
FString mapname = argv[1];
FString mapfilename = mapname;
DefaultExtension(mapfilename, ".map");
auto map = FindMapByName(mapname);
if (map == nullptr)
{
@ -379,6 +380,11 @@ CCMD(changemap)
Printf(PRINT_BOLD, "%s: Cannot warp to user maps.\n", mapname.GetChars());
return;
}
if (fileSystem.FindFile(map->fileName) < 0)
{
Printf(PRINT_BOLD, "%s: map file not found\n", map->fileName.GetChars());
}
ChangeLevel(map, -1);
}
@ -420,6 +426,11 @@ CCMD(map)
}
if (map)
{
if (fileSystem.FindFile(map->fileName) < 0)
{
Printf(PRINT_BOLD, "%s: map file not found\n", map->fileName.GetChars());
}
DeferedStartGame(map, -1);
}
}