game_launch: fix gamedir pointer being lost

This commit is contained in:
Alibek Omarov 2022-06-12 03:07:37 +03:00
parent 5524aaae1e
commit 8eec5389fe

View File

@ -138,7 +138,6 @@ static void Sys_ChangeGame( const char *progname )
{
if( !progname || !progname[0] )
Xash_Error( "Sys_ChangeGame: NULL gamedir" );
#if USE_EXECVE_FOR_CHANGE_GAME
#if XASH_WIN32
_putenv_s( E_GAME, progname );
@ -157,8 +156,9 @@ static void Sys_ChangeGame( const char *progname )
if( Xash_Shutdown == NULL )
Xash_Error( "Sys_ChangeGame: missed 'Host_Shutdown' export\n" );
Sys_UnloadEngine();
strncpy( szGameDir, progname, sizeof( szGameDir ) - 1 );
Sys_UnloadEngine();
Sys_LoadEngine ();
Xash_Main( szArgc, szArgv, szGameDir, 1, Sys_ChangeGame );
#endif