diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/g_main.c | 11 | ||||
-rw-r--r-- | src/game/g_maprotation.c | 7 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c index 15a4cb69..4858c75c 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -581,15 +581,20 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) else G_Printf( "Not logging to disk\n" ); + if( g_mapConfigs.string[ 0 ] && !trap_Cvar_VariableIntegerValue( "g_mapConfigsLoaded" ) ) { char map[ MAX_CVAR_VALUE_STRING ] = {""}; + G_Printf( "InitGame: executing map configuration scripts and restarting\n" ); trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) ); G_MapConfigs( map ); + trap_SendConsoleCommand( EXEC_APPEND, "wait\nmap_restart 0\n" ); + } + else + { + // we're done with g_mapConfigs, so reset this for the next map + trap_Cvar_Set( "g_mapConfigsLoaded", "0" ); } - - // we're done with g_mapConfigs, so reset this for the next map - trap_Cvar_Set( "g_mapConfigsLoaded", "0" ); // set this cvar to 0 if it exists, but otherwise avoid its creation if( trap_Cvar_VariableIntegerValue( "g_rangeMarkerWarningGiven" ) ) diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c index fde6f8fc..0487079c 100644 --- a/src/game/g_maprotation.c +++ b/src/game/g_maprotation.c @@ -130,6 +130,9 @@ G_PerformMapRestart */ void G_PerformMapRestart( void ) { + char map[ MAX_CVAR_VALUE_STRING ]; + trap_Cvar_VariableStringBuffer( "mapname", map, sizeof( map ) ); + G_MapConfigs( map ); level.restarted = qtrue; trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" ); } @@ -142,6 +145,7 @@ G_PerformMapChange void G_PerformMapChange( const char *map ) { char buf[ MAX_STRING_CHARS ]; + G_MapConfigs( map ); level.restarted = qtrue; Q_snprintf( buf, sizeof( buf ), "map \"%s\"\n", map ); trap_SendConsoleCommand( EXEC_APPEND, buf ); @@ -895,9 +899,6 @@ static void G_IssueMapChange( int index, int rotation ) G_PerformMapChange( map->name ); - // Load up map defaults if g_mapConfigs is set - G_MapConfigs( map->name ); - if( strlen( map->postCommand ) > 0 ) trap_SendConsoleCommand( EXEC_APPEND, map->postCommand ); } |