diff options
author | /dev/humancontroller <devhc@example.com> | 2017-02-07 20:37:29 +0100 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:15 +0100 |
commit | 4e42f2df0f599e0beb5e2a935049fb0670ba3e2b (patch) | |
tree | a511d791a129e453dc306949154cb2ab36cffa73 /src/game/g_main.c | |
parent | 5092712ab377f401fa0b874a990ab7d3cabd08db (diff) |
begin rewriting the voting code to be structured in the representation of votes
with this, at least, the "vote action will restart the map" check can be performed in a non-hacky way
Diffstat (limited to 'src/game/g_main.c')
-rw-r--r-- | src/game/g_main.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/game/g_main.c b/src/game/g_main.c index 5ab04d94..15a4cb69 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -2044,13 +2044,34 @@ FUNCTIONS CALLED EVERY FRAME void G_ExecuteVote( team_t team ) { + vote_t *v = &level.votes[ team ]; + level.voteExecuteTime[ team ] = 0; - trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", - level.voteString[ team ] ) ); + switch( v->cons ) + { + case VC_RESTART: + G_PerformMapRestart(); + break; + case VC_MAP: + case VC_NEXTMAP: + { + mapVotePms_t *p = &v->pms.map; + if( v->cons == VC_NEXTMAP ) + { + trap_Cvar_Set( "g_nextMap", p->map ); + trap_Cvar_Update( &g_nextMap ); + } + else + G_PerformMapChange( p->map ); + BG_Free( p->map ); + break; + } + default: + trap_SendConsoleCommand( EXEC_APPEND, va( "%s\n", level.voteString[ team ] ) ); + } - if( !Q_stricmpn( level.voteString[ team ], "map", 3 ) ) - level.restarted = qtrue; + v->cons = VC_OTHER; } /* |