From 5092712ab377f401fa0b874a990ab7d3cabd08db Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Thu, 9 Mar 2017 07:06:30 +0100 Subject: add G_PerformMapChange() and G_PerformMapRestart(), and use them currently, they abstract the use of trap_SendConsoleCommand() this change happens to add an instance of ``level.restarted = qtrue;'' --- src/game/g_maprotation.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/game/g_maprotation.c') diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c index e9f87b37..fde6f8fc 100644 --- a/src/game/g_maprotation.c +++ b/src/game/g_maprotation.c @@ -123,6 +123,30 @@ qboolean G_MapExists( char *name ) return trap_FS_FOpenFile( va( "maps/%s.bsp", name ), NULL, FS_READ ); } +/* +=============== +G_PerformMapRestart +=============== +*/ +void G_PerformMapRestart( void ) +{ + level.restarted = qtrue; + trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" ); +} + +/* +=============== +G_PerformMapChange +=============== +*/ +void G_PerformMapChange( const char *map ) +{ + char buf[ MAX_STRING_CHARS ]; + level.restarted = qtrue; + Q_snprintf( buf, sizeof( buf ), "map \"%s\"\n", map ); + trap_SendConsoleCommand( EXEC_APPEND, buf ); +} + /* =============== G_RotationExists @@ -869,7 +893,7 @@ static void G_IssueMapChange( int index, int rotation ) trap_Cvar_Set( "g_layouts", map->layouts ); } - trap_SendConsoleCommand( EXEC_APPEND, va( "map \"%s\"\n", map->name ) ); + G_PerformMapChange( map->name ); // Load up map defaults if g_mapConfigs is set G_MapConfigs( map->name ); -- cgit