• R/O
  • SSH

zandronum-sandbox-stable: Commit


Commit MetaInfo

Revisionb881e0c2f8992d67486ffcd4290935cc50ae3bb7 (tree)
Time2022-10-02 12:32:38
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Added a small optimization to ServerCommands::KillPlayer::Execute.

Change Summary

Incremental Difference

diff -r 17192f5db27c -r b881e0c2f899 src/cl_main.cpp
--- a/src/cl_main.cpp Sat Oct 01 12:01:38 2022 -0400
+++ b/src/cl_main.cpp Sat Oct 01 23:32:38 2022 -0400
@@ -3911,6 +3911,9 @@
39113911 //
39123912 void ServerCommands::KillPlayer::Execute()
39133913 {
3914+ // [AK] Check if this player's killer was another valid player.
3915+ const ULONG ulSourcePlayer = (( source ) && ( source->player ) && ( source->player->mo == source )) ? source->player - players : MAXPLAYERS;
3916+
39143917 // Set the player's new health.
39153918 player->health = player->mo->health = health;
39163919
@@ -3927,23 +3930,6 @@
39273930 if ( player->health <= 0 )
39283931 player->health = 0;
39293932
3930- // [TP] FIXME: Wouldn't this be much easier to compute using source->player?
3931- ULONG ulSourcePlayer = MAXPLAYERS;
3932- for ( ULONG ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ )
3933- {
3934- if (( playeringame[ulIdx] == false ) ||
3935- ( players[ulIdx].mo == NULL ))
3936- {
3937- continue;
3938- }
3939-
3940- if ( players[ulIdx].mo == source )
3941- {
3942- ulSourcePlayer = ulIdx;
3943- break;
3944- }
3945- }
3946-
39473933 // [AK] Try to draw a large frag message if we (the consoleplayer) were fragged (by) another player.
39483934 HUD_PrepareToDrawFragMessage( player, source, MOD );
39493935
Show on old repository browser