From 9811988ccebbb454b461ed5019c8867e0485a974 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 26 Dec 2024 02:50:30 +0300 Subject: [PATCH] engine: server: set mapname globals field before making first call into DLL, as some mods tend to read it too early --- engine/server/sv_save.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/server/sv_save.c b/engine/server/sv_save.c index 978f9a683..28d844594 100644 --- a/engine/server/sv_save.c +++ b/engine/server/sv_save.c @@ -1606,6 +1606,10 @@ static int LoadGameState( char const *level, qboolean changelevel ) pSaveData = LoadSaveData( level ); if( !pSaveData ) return 0; // couldn't load the file + // must set mapname before calling into DLL + Q_strncpy( sv.name, level, sizeof( sv.name )); + svgame.globals->mapname = MAKE_STRING( sv.name ); + ParseSaveTables( pSaveData, &header, true ); EntityPatchRead( pSaveData, level ); @@ -1613,8 +1617,6 @@ static int LoadGameState( char const *level, qboolean changelevel ) sv.loadgame = sv.paused = true; Cvar_SetValue( "skill", header.skillLevel ); - Q_strncpy( sv.name, header.mapName, sizeof( sv.name )); - svgame.globals->mapname = MAKE_STRING( sv.name ); Cvar_Set( "sv_skyname", header.skyName ); // restore sky parms