summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2019-08-27 00:42:24 +0100
committerIronClawTrem <louie.nutman@gmail.com>2019-08-27 00:42:24 +0100
commit514d15b659bb4284fdb2a17e200480048ae56fbc (patch)
tree78e0feb44994788375e7612793f354f82644ff63
parentb4948d3fef13d551bc976bccf7c554d49bc6233c (diff)
restart the current map if the next map is the same as the current map
-rw-r--r--src/game/g_main.c8
-rw-r--r--src/game/g_maprotation.c12
2 files changed, 17 insertions, 3 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c
index 5386f9f..4ae31bb 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -1868,6 +1868,10 @@ void ExitLevel( void )
gclient_t *cl;
buildHistory_t *tmp, *mark;
+ char currentmap[ MAX_CVAR_VALUE_STRING ];
+
+ trap_Cvar_VariableStringBuffer( "mapname", currentmap, sizeof( currentmap ));
+
if( level.mapRotationVoteTime )
{
if( level.time < level.mapRotationVoteTime &&
@@ -1892,7 +1896,9 @@ void ExitLevel( void )
}
}
- if ( G_MapExists( g_nextMap.string ) )
+ if( !Q_stricmp( currentmap, g_nextMap.string ) )
+ trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" );
+ else if ( G_MapExists( g_nextMap.string ) )
trap_SendConsoleCommand( EXEC_APPEND, va("!map %s\n", g_nextMap.string ) );
else if( G_MapRotationActive( ) )
G_AdvanceMapRotation( );
diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c
index a9d0261..a846c79 100644
--- a/src/game/g_maprotation.c
+++ b/src/game/g_maprotation.c
@@ -680,8 +680,10 @@ static void G_IssueMapChange( int rotation )
int map = G_GetCurrentMap( rotation );
char cmd[ MAX_TOKEN_CHARS ];
char newmap[ MAX_CVAR_VALUE_STRING ];
+ char currentmap[ MAX_CVAR_VALUE_STRING ];
Q_strncpyz( newmap, mapRotations.rotations[rotation].maps[map].name, sizeof( newmap ));
+ trap_Cvar_VariableStringBuffer( "mapname", currentmap, sizeof( currentmap ));
if (!Q_stricmp( newmap, "*VOTE*") )
{
@@ -722,8 +724,14 @@ static void G_IssueMapChange( int rotation )
mapRotations.rotations[ rotation ].maps[ map ].layouts );
}
- trap_SendConsoleCommand( EXEC_APPEND, va( "map %s\n",
- newmap ) );
+ if( !Q_stricmp( currentmap, newmap ) )
+ {
+ trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" );
+ }
+ else
+ {
+ trap_SendConsoleCommand( EXEC_APPEND, va( "map %s\n", newmap ) );
+ }
// load up map defaults if g_mapConfigs is set
G_MapConfigs( newmap );