From a92ed49c40ee36c47e6fc5ab3d1e0b9f0a9ecd68 Mon Sep 17 00:00:00 2001 From: "Tony J. White" Date: Thu, 14 Sep 2006 21:19:06 +0000 Subject: * (bug 2666) G_MapConfigs() would try to execute the .cfg for the map that was finishing instead of the one that was loading when invoked from the maprotation system. --- src/game/g_local.h | 2 +- src/game/g_main.c | 16 ++++++++++------ src/game/g_maprotation.c | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/game/g_local.h b/src/game/g_local.h index a905e15d..8020ac08 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -884,7 +884,7 @@ void FireWeapon3( gentity_t *ent ); // void ScoreboardMessage( gentity_t *client ); void MoveClientToIntermission( gentity_t *client ); -void G_MapConfigs( void ); +void G_MapConfigs( const char *mapname ); void CalculateRanks( void ); void FindIntermissionPoint( void ); void G_RunThink( gentity_t *ent ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 2d2a1427..c10b547f 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -463,9 +463,8 @@ void G_UpdateCvars( void ) G_MapConfigs ================= */ -void G_MapConfigs( ) +void G_MapConfigs( const char *mapname ) { - char map[MAX_QPATH] = {""}; if( !g_mapConfigs.string[0] ) return; @@ -475,10 +474,9 @@ void G_MapConfigs( ) trap_SendConsoleCommand( EXEC_APPEND, va( "exec \"%s/default.cfg\"\n", g_mapConfigs.string ) ); - - trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) ); + trap_SendConsoleCommand( EXEC_APPEND, - va( "exec \"%s/%s.cfg\"\n", g_mapConfigs.string, map ) ); + va( "exec \"%s/%s.cfg\"\n", g_mapConfigs.string, mapname ) ); trap_Cvar_Set( "g_mapConfigsLoaded", "1" ); } @@ -536,7 +534,13 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) else G_Printf( "Not logging to disk\n" ); - G_MapConfigs( ); + { + char map[ MAX_CVAR_VALUE_STRING ] = {""}; + + trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) ); + G_MapConfigs( map ); + } + // we're done with g_mapConfigs, so reset this for the next map trap_Cvar_Set( "g_mapConfigsLoaded", "0" ); diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c index be4d5068..ad4e5cf4 100644 --- a/src/game/g_maprotation.c +++ b/src/game/g_maprotation.c @@ -480,7 +480,7 @@ static void G_IssueMapChange( int rotation ) mapRotations.rotations[ rotation ].maps[ map ].name ) ); // load up map defaults if g_mapConfigs is set - G_MapConfigs( ); + G_MapConfigs( mapRotations.rotations[ rotation ].maps[ map ].name ); for( i = 0; i < mapRotations.rotations[ rotation ].maps[ map ].numCmds; i++ ) { -- cgit