summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikko Tiusanen <ams@daug.net>2014-08-19 23:59:59 +0300
committerMikko Tiusanen <ams@daug.net>2014-08-19 23:59:59 +0300
commit7ad16ee1fea76bab54d97a78c1063b7c2c2adef6 (patch)
tree8bb1b1338a6b6b7f393623dd8e083c1754ea4b29 /src
parenta7ca0aa8c8a66adce30b8ac21d4849b91e4fc75b (diff)
Added layout selection support to nextmap vote.
Diffstat (limited to 'src')
-rw-r--r--src/game/g_cmds.c30
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_main.c11
-rw-r--r--src/game/g_maprotation.c2
4 files changed, 34 insertions, 10 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 77c6f82..21962ca 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -1476,8 +1476,8 @@ void Cmd_CallVote_f( gentity_t *ent )
if( G_MapExists( g_nextMap.string ) )
{
trap_SendServerCommand( ent-g_entities,
- va( "print \"%s: the next map is already set to '%s'\n\"",
- cmd, g_nextMap.string ) );
+ va( "print \"%s: the next map is already set to '%s' layout '%s'\n\"",
+ cmd, g_nextMap.string, g_nextLayout.string ) );
return;
}
@@ -1489,11 +1489,27 @@ void Cmd_CallVote_f( gentity_t *ent )
return;
}
- Com_sprintf( level.voteString[ team ], sizeof( level.voteString[ team ] ),
- "set g_nextMap \"%s\"", arg );
- Com_sprintf( level.voteDisplayString[ team ],
- sizeof( level.voteDisplayString[ team ] ),
- "Set the ^1next^5 map to '%s'", arg );
+ if( reason[0] )
+ {
+ if( !G_LayoutExists( arg, reason ) )
+ {
+ trap_SendServerCommand( ent-g_entities,
+ va( "print \"%s: 'layouts/%s/%s.dat' could not be found on the server\n\"",
+ cmd, arg, reason ) );
+ return;
+ }
+ Com_sprintf( level.voteString[ team ], sizeof( level.voteString[ team ] ),
+ "set g_nextMap \"%s\"; set g_nextLayout \"%s\"", arg, reason );
+ Com_sprintf( level.voteDisplayString[ team ],
+ sizeof( level.voteDisplayString[ team ] ),
+ "Set the ^1next^5 map to '%s' layout '%s'", arg, reason );
+ } else {
+ Com_sprintf( level.voteString[ team ], sizeof( level.voteString[ team ] ),
+ "set g_nextMap \"%s\"", arg );
+ Com_sprintf( level.voteDisplayString[ team ],
+ sizeof( level.voteDisplayString[ team ] ),
+ "Set the ^1next^5 map to '%s'", arg );
+ }
}
else if( !Q_stricmp( vote, "draw" ) )
{
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 2683ac5..7052fe4 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1244,6 +1244,7 @@ extern vmCvar_t g_mapRotationNodes;
extern vmCvar_t g_mapRotationStack;
extern vmCvar_t g_mapLog;
extern vmCvar_t g_nextMap;
+extern vmCvar_t g_nextLayout;
extern vmCvar_t g_initialMapRotation;
extern vmCvar_t g_sayAreaRange;
extern vmCvar_t g_debugVoices;
diff --git a/src/game/g_main.c b/src/game/g_main.c
index c644bdd..1899f2d 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -152,6 +152,7 @@ vmCvar_t g_mapRotationNodes;
vmCvar_t g_mapRotationStack;
vmCvar_t g_mapLog;
vmCvar_t g_nextMap;
+vmCvar_t g_nextLayout;
vmCvar_t g_initialMapRotation;
vmCvar_t g_debugVoices;
vmCvar_t g_voiceChats;
@@ -320,6 +321,7 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_mapRotationStack, "g_mapRotationStack", "", CVAR_ROM, 0, qfalse },
{ &g_mapLog, "g_mapLog", "", CVAR_ROM, 0, qfalse },
{ &g_nextMap, "g_nextMap", "", 0 , 0, qtrue },
+ { &g_nextLayout, "g_nextLayout", "", 0, 0, qtrue },
{ &g_initialMapRotation, "g_initialMapRotation", "", CVAR_ARCHIVE, 0, qfalse },
{ &g_debugVoices, "g_debugVoices", "0", 0, 0, qfalse },
{ &g_voiceChats, "g_voiceChats", "1", CVAR_ARCHIVE, 0, qfalse },
@@ -1808,14 +1810,17 @@ void ExitLevel( void )
int i;
gclient_t *cl;
- if ( G_MapExists( g_nextMap.string ) )
- trap_SendConsoleCommand( EXEC_APPEND, va("map \"%s\"\n", g_nextMap.string ) );
- else if( G_MapRotationActive( ) )
+ if ( G_MapExists( g_nextMap.string ) ) {
+ if ( G_LayoutExists( g_nextMap.string, g_nextLayout.string ) ) {
+ trap_SendConsoleCommand( EXEC_APPEND, va("map \"%s\" \"%s\"\n", g_nextMap.string, g_nextLayout.string ) );
+ } else trap_SendConsoleCommand( EXEC_APPEND, va("map \"%s\"\n", g_nextMap.string ) );
+ } else if( G_MapRotationActive( ) )
G_AdvanceMapRotation( 0 );
else
trap_SendConsoleCommand( EXEC_APPEND, "map_restart\n" );
trap_Cvar_Set( "g_nextMap", "" );
+ trap_Cvar_Set( "g_nextLayout", "" );
level.restarted = qtrue;
level.changemap = NULL;
diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c
index 05b9969..2de77f0 100644
--- a/src/game/g_maprotation.c
+++ b/src/game/g_maprotation.c
@@ -762,6 +762,8 @@ void G_PrintCurrentRotation( gentity_t *ent, const char *command )
if( g_nextMap.string[ 0 ] )
ADMBP( va( "^3the next map has been set to %s\n", g_nextMap.string ) );
+ if( g_nextLayout.string[ 0 ] )
+ ADMBP( va( "^3the next layout has been set to %s\n", g_nextLayout.string ) );
ADMBP_end( );
}