This is a fork of Zandronum Beta for Mac Os (Silicon and Intel)
Revisión | 4cfb3337055305dc0c9c3679304bc943c99befe7 (tree) |
---|---|
Tiempo | 2022-11-27 12:56:59 |
Autor | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Added the helper function PLAYER_SetTime.
@@ -4416,7 +4416,7 @@ | ||
4416 | 4416 | // |
4417 | 4417 | void ServerCommands::UpdatePlayerTime::Execute() |
4418 | 4418 | { |
4419 | - player->ulTime = time * ( TICRATE * 60 ); | |
4419 | + PLAYER_SetTime( player, time * ( TICRATE * 60 )); | |
4420 | 4420 | } |
4421 | 4421 | |
4422 | 4422 | //***************************************************************************** |
@@ -798,6 +798,7 @@ | ||
798 | 798 | void PLAYER_SetWins( player_t *pPlayer, ULONG ulWins ); |
799 | 799 | void PLAYER_SetKills( player_t *pPlayer, ULONG ulKills ); |
800 | 800 | void PLAYER_SetDeaths( player_t *pPlayer, ULONG ulDeaths, bool bInformClients = true ); |
801 | +void PLAYER_SetTime( player_t *pPlayer, ULONG ulTime ); | |
801 | 802 | void PLAYER_SetStatus( player_t *pPlayer, ULONG ulType, bool bEnable, ULONG ulFlags = 0 ); |
802 | 803 | // [BB] PLAYER_GetHealth and PLAYER_GetLivesLeft are helper functions for PLAYER_GetPlayerWithSingleHighestValue. |
803 | 804 | LONG PLAYER_GetHealth( ULONG ulPlayer ); |
@@ -2821,6 +2821,30 @@ | ||
2821 | 2821 | |
2822 | 2822 | //***************************************************************************** |
2823 | 2823 | // |
2824 | +void PLAYER_SetTime( player_t *pPlayer, ULONG ulTime ) | |
2825 | +{ | |
2826 | + if ( pPlayer == NULL ) | |
2827 | + return; | |
2828 | + | |
2829 | + // Set the player's time. | |
2830 | + pPlayer->ulTime = ulTime; | |
2831 | + | |
2832 | + // Potentially update the scoreboard or send out an update. | |
2833 | + if ( NETWORK_GetState( ) == NETSTATE_SERVER ) | |
2834 | + { | |
2835 | + if (( pPlayer->ulTime % ( TICRATE * 60 )) == 0 ) | |
2836 | + { | |
2837 | + // Send out the updated time field to all clients. | |
2838 | + SERVERCOMMANDS_UpdatePlayerTime( pPlayer - players ); | |
2839 | + | |
2840 | + // Update the console as well. | |
2841 | + SERVERCONSOLE_UpdatePlayerInfo( pPlayer - players, UDF_TIME ); | |
2842 | + } | |
2843 | + } | |
2844 | +} | |
2845 | + | |
2846 | +//***************************************************************************** | |
2847 | +// | |
2824 | 2848 | void PLAYER_SetStatus( player_t *pPlayer, ULONG ulType, bool bEnable, ULONG ulFlags ) |
2825 | 2849 | { |
2826 | 2850 | if ( pPlayer == NULL ) |
@@ -357,26 +357,8 @@ | ||
357 | 357 | for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ ) |
358 | 358 | { |
359 | 359 | // Increment individual player time. |
360 | - if ( NETWORK_InClientMode() == false ) | |
361 | - { | |
362 | - if ( playeringame[ulIdx] ) | |
363 | - { | |
364 | - players[ulIdx].ulTime++; | |
365 | - | |
366 | - // Potentially update the scoreboard or send out an update. | |
367 | - if ( NETWORK_GetState( ) == NETSTATE_SERVER ) | |
368 | - { | |
369 | - if (( players[ulIdx].ulTime % ( TICRATE * 60 )) == 0 ) | |
370 | - { | |
371 | - // Send out the updated time field to all clients. | |
372 | - SERVERCOMMANDS_UpdatePlayerTime( ulIdx ); | |
373 | - | |
374 | - // Update the console as well. | |
375 | - SERVERCONSOLE_UpdatePlayerInfo( ulIdx, UDF_TIME ); | |
376 | - } | |
377 | - } | |
378 | - } | |
379 | - } | |
360 | + if (( NETWORK_InClientMode( ) == false ) && ( playeringame[ulIdx] )) | |
361 | + PLAYER_SetTime( &players[ulIdx], players[ulIdx].ulTime + 1 ); | |
380 | 362 | |
381 | 363 | // Clients "think" every time we process a movement command. |
382 | 364 | // [BB] The server has to think for lagging clients, otherwise they aren't affected by things like sector damage. |