]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Join ifs
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index 99aa86d24f82d7d233fc12f6fff56e2661252376..7ce1674b19f96d247851aa452de0a18f089fa5f7 100644 (file)
 #include "teamplay.qh"
 #include "spawnpoints.qh"
 #include "resources.qh"
-#include "g_damage.qh"
+#include "damage.qh"
 #include "handicap.qh"
-#include "g_hook.qh"
+#include "hook.qh"
 #include "command/common.qh"
 #include "command/vote.qh"
 #include "clientkill.qh"
 #include "cheats.qh"
-#include "g_world.qh"
+#include "world.qh"
 #include <server/gamelog.qh>
 #include "race.qh"
-#include <server/sv_main.qh>
+#include <server/main.qh>
 #include "antilag.qh"
 #include "campaign.qh"
 #include "command/common.qh"
@@ -83,6 +83,8 @@
 
 #include <common/weapons/weapon/vortex.qh>
 
+#define CHAT_NOSPECTATORS() ((autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage))
+
 STATIC_METHOD(Client, Add, void(Client this, int _team))
 {
     ClientConnect(this);
@@ -303,12 +305,8 @@ void PutObserverInServer(entity this)
 
        WaypointSprite_PlayerDead(this);
 
-       if (CS(this).killcount != FRAGS_SPECTATOR)
-       {
-               if(!game_stopped)
-               if(autocvar_g_chat_nospectators == 1 || (!warmup_stage && autocvar_g_chat_nospectators == 2))
-                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
-       }
+       if (CS(this).killcount != FRAGS_SPECTATOR && !game_stopped && CHAT_NOSPECTATORS())
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
 
        accuracy_resend(this);
 
@@ -2969,10 +2967,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
        var .float flood_field = floodcontrol_chat;
        if(floodcontrol && source)
        {
-               float flood_spl;
-               float flood_burst;
-               float flood_lmax;
-               float lines;
+               float flood_spl, flood_burst, flood_lmax;
                if(privatesay)
                {
                        flood_spl = autocvar_g_chat_flood_spl_tell;
@@ -3002,7 +2997,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                {
                        getWrappedLine_remaining = msgstr;
                        msgstr = "";
-                       lines = 0;
+                       int lines = 0;
                        while(getWrappedLine_remaining && (!flood_lmax || lines <= flood_lmax))
                        {
                                msgstr = strcat(msgstr, " ", getWrappedLineLen(82.4289758859709, strlennocol)); // perl averagewidth.pl < gfx/vera-sans.width
@@ -3059,11 +3054,10 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                sourcecmsgstr = cmsgstr;
        }
 
-       if (!privatesay && source && !(IS_PLAYER(source) || source.caplayer))
+       if (!privatesay && source && !(IS_PLAYER(source) || source.caplayer) && !game_stopped
+               && (teamsay || CHAT_NOSPECTATORS()))
        {
-               if (!game_stopped)
-               if (teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage))
-                       teamsay = -1; // spectators
+               teamsay = -1; // spectators
        }
 
        if(flood)
@@ -3094,11 +3088,10 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                ret = 1;
        }
 
-       if (privatesay && source && !(IS_PLAYER(source) || source.caplayer))
+       if (privatesay && source && !(IS_PLAYER(source) || source.caplayer) && !game_stopped
+               && (IS_PLAYER(privatesay) || privatesay.caplayer) && CHAT_NOSPECTATORS())
        {
-               if (!game_stopped)
-               if ((privatesay && (IS_PLAYER(privatesay) || privatesay.caplayer)) && ((autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage)))
-                       ret = -1; // just hide the message completely
+               ret = -1; // just hide the message completely
        }
 
        MUTATOR_CALLHOOK(ChatMessage, source, ret);