From 622d88eeba5ca4439e54dd0da04f67a7bea0e639 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 17 Nov 2024 13:38:14 +0300 Subject: [PATCH] engine: client: only check active tempentities when detaching player following tents --- engine/client/cl_tent.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 9b59acb2..de2e4de6 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -777,25 +777,15 @@ Detach entity from player */ void GAME_EXPORT R_KillAttachedTents( int client ) { - int i; + TEMPENTITY *tent; if( client <= 0 || client > cl.maxclients ) return; - for( i = 0; i < GI->max_tents; i++ ) + for( tent = cl_active_tents; tent; tent = tent->next ) { - TEMPENTITY *pTemp = &cl_tempents[i]; - - if( !FBitSet( pTemp->flags, FTENT_PLYRATTACHMENT )) - continue; - - // this TEMPENTITY is player attached. - // if it is attached to this client, set it to die instantly. - if( pTemp->clientIndex == client ) - { - // good enough, it will die on next tent update. - pTemp->die = cl.time; - } + if( FBitSet( tent->flags, FTENT_PLYRATTACHMENT ) && tent->clientIndex == client ) + tent->die = cl.time; } }