From: terencehill Date: Fri, 16 Apr 2021 16:15:11 +0000 (+0200) Subject: Get rid of a couple backtraces printed in the console when a player is kicked for... X-Git-Tag: xonotic-v0.8.5~444 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5b5193a852a609113ddce0cd60cbc31c157ea0c4;p=xonotic%2Fxonotic-data.pk3dir.git Get rid of a couple backtraces printed in the console when a player is kicked for not playing (added a missing return;) --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 0f4a46bf9..08a0b68da 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2095,23 +2095,6 @@ int nJoinAllowed(entity this, entity ignore) return free_slots; } -/** - * Checks whether the client is an observer or spectator, if so, he will get kicked after - * g_maxplayers_spectator_blocktime seconds - */ -void checkSpectatorBlock(entity this) -{ - if(IS_SPEC(this) || IS_OBSERVER(this)) - if(!this.caplayer) - if(IS_REAL_CLIENT(this)) - { - if( time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) { - Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING); - dropclient(this); - } - } -} - void PrintWelcomeMessage(entity this) { if(CS(this).motd_actived_time == 0) @@ -2475,12 +2458,17 @@ void PlayerPreThink (entity this) if (frametime) { // physics frames: update anticheat stuff anticheat_prethink(this); - } - if (blockSpectators && frametime) { // WORKAROUND: only use dropclient in server frames (frametime set). // Never use it in cl_movement frames (frametime zero). - checkSpectatorBlock(this); + if (blockSpectators && IS_REAL_CLIENT(this) + && (IS_SPEC(this) || IS_OBSERVER(this)) && !this.caplayer + && time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime)) + { + Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING); + dropclient(this); + return; + } } zoomstate_set = false; diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 4dd93563e..ed3273be8 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -365,8 +365,6 @@ void ClientData_Touch(entity e); int nJoinAllowed(entity this, entity ignore); -void checkSpectatorBlock(entity this); - void PlayerUseKey(entity this); void FixClientCvars(entity e);