- fixed FileExists check for -loadgame.

This was done before the current savegame path was known so it always errored out.
This commit is contained in:
Christoph Oelckers 2022-11-05 23:24:45 +01:00
parent 35f07008cf
commit eb369b24c3

View file

@ -3430,6 +3430,10 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray<FString>& allwads, TArr
if (v) if (v)
{ {
FString file = G_BuildSaveName(v); FString file = G_BuildSaveName(v);
if (!FileExists(file))
{
I_FatalError("Cannot find savegame %s", file.GetChars());
}
G_LoadGame(file); G_LoadGame(file);
} }
@ -3607,17 +3611,6 @@ static int D_DoomMain_Internal (void)
// Now that we have the IWADINFO, initialize the autoload ini sections. // Now that we have the IWADINFO, initialize the autoload ini sections.
GameConfig->DoAutoloadSetup(iwad_man); GameConfig->DoAutoloadSetup(iwad_man);
// Prevent the game from starting if the savegame passed to -loadgame is invalid
v = Args->CheckValue("-loadgame");
if (v)
{
FString file = G_BuildSaveName(v);
if (!FileExists(file))
{
I_FatalError("Cannot find savegame %s", file.GetChars());
}
}
// reinit from here // reinit from here
do do