summaryrefslogtreecommitdiff
path: root/src/game/g_maprotation.c
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-03-09 07:06:30 +0100
committer/dev/humancontroller <devhc@example.com>2017-03-09 13:51:15 +0100
commit5092712ab377f401fa0b874a990ab7d3cabd08db (patch)
tree4855836136cd09c9c22501098c08a795cb4c3712 /src/game/g_maprotation.c
parentac941c9413cf378985e7506f1c245fbfdf319e60 (diff)
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;''
Diffstat (limited to 'src/game/g_maprotation.c')
-rw-r--r--src/game/g_maprotation.c26
1 files changed, 25 insertions, 1 deletions
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
@@ -125,6 +125,30 @@ qboolean G_MapExists( char *name )
/*
===============
+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
Check if a rotation exists
@@ -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 );