diff options
| author | kai <kai@zittrig.eu> | 2020-04-28 18:16:01 +0100 | 
|---|---|---|
| committer | kai <kai@zittrig.eu> | 2020-04-28 18:18:21 +0100 | 
| commit | b32cd68b200704346ccff4a24e3969cfa697456b (patch) | |
| tree | 10c1ab47fb8d736b5af5186530569b16dcc34f02 /src/cgame | |
| parent | 79c76f434c9a24fa99ca7026ee4529b1e31914b9 (diff) | |
change how configstrings are handled, and send existing votes to new clients
Diffstat (limited to 'src/cgame')
| -rw-r--r-- | src/cgame/cg_local.h | 1 | ||||
| -rw-r--r-- | src/cgame/cg_main.c | 16 | ||||
| -rw-r--r-- | src/cgame/cg_servercmds.c | 24 | 
3 files changed, 34 insertions, 7 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index a1ff0a6..98a2a1e 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1778,6 +1778,7 @@ void          CG_ExecuteNewServerCommands( int latestSequence );  void          CG_ParseServerinfo( void );  void          CG_SetConfigValues( void );  void          CG_ShaderStateChanged(void); +void          CG_ConfigStringModified( int );  //  // cg_playerstate.c diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index ce32b0e..8fcf95e 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -2062,6 +2062,22 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum )    trap_S_ClearLoopingSounds( qtrue ); +  // load any existing votes +  CG_ConfigStringModified( CS_VOTE_TIME ); +  CG_ConfigStringModified( CS_VOTE_STRING ); +  CG_ConfigStringModified( CS_VOTE_YES ); +  CG_ConfigStringModified( CS_VOTE_NO ); + +  CG_ConfigStringModified( CS_TEAMVOTE_TIME ); +  CG_ConfigStringModified( CS_TEAMVOTE_STRING ); +  CG_ConfigStringModified( CS_TEAMVOTE_YES ); +  CG_ConfigStringModified( CS_TEAMVOTE_NO ); + +  CG_ConfigStringModified( CS_TEAMVOTE_TIME + 1 ); +  CG_ConfigStringModified( CS_TEAMVOTE_STRING + 1 ); +  CG_ConfigStringModified( CS_TEAMVOTE_YES + 1 ); +  CG_ConfigStringModified( CS_TEAMVOTE_NO + 1 ); +    trap_Cvar_Set( "ui_loading", "0" );  } diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 7fb3e06..c87e7a7 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -247,20 +247,30 @@ static void CG_AnnounceHumanStageTransistion( stage_t from, stage_t to )  /*  ================ -CG_ConfigStringModified +CG_ConfigStringModifiedSvcmd  ================  */ -static void CG_ConfigStringModified( void ) +static void CG_ConfigStringModifiedSvcmd( void ) +                      { -  const char  *str;    int         num; -    num = atoi( CG_Argv( 1 ) ); -    // get the gamestate from the client system, which will have the    // new configstring already integrated -  trap_GetGameState( &cgs.gameState ); +  trap_GetGameState( &cgs.gameState ); // enneract: not needed when calling from CG_Init +  CG_ConfigStringModified( num ); +} + +/* +================ +CG_ConfigStringModified + +================ +*/ +void CG_ConfigStringModified( int num ) +{ +  const char  *str;    // look up the individual string that was modified    str = CG_ConfigString( num ); @@ -848,7 +858,7 @@ static void CG_ServerCommand( void )    if( !strcmp( cmd, "cs" ) )    { -    CG_ConfigStringModified( ); +    CG_ConfigStringModifiedSvcmd( );      return;    }  | 
