]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/ent_cs.qh
Merge branch 'master' into Mario/hagar_notfixed
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / ent_cs.qh
index 363103b379240df971717a17b8cc5daa8f191e78..0d02e4b538e3f789981118358500052609b3399e 100644 (file)
@@ -41,16 +41,17 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
 
 #ifdef CSQC
 
-       AL_declare(_entcs);
+       ArrayList _entcs;
        STATIC_INIT(_entcs)
        {
-               AL_init(_entcs, 255, NULL, e);  // 255 is the engine limit on maxclients
+               AL_NEW(_entcs, 255, NULL, e);  // 255 is the engine limit on maxclients
        }
        SHUTDOWN(_entcs)
        {
-               AL_delete(_entcs);
+               AL_DELETE(_entcs);
        }
-       #define entcs_receiver(...) EVAL(OVERLOAD(entcs_receiver, __VA_ARGS__))
+       #define entcs_receiver(...) EVAL_entcs_receiver(OVERLOAD(entcs_receiver, __VA_ARGS__))
+       #define EVAL_entcs_receiver(...) __VA_ARGS__
        #define entcs_receiver_1(i) AL_gete(_entcs, i)
        #define entcs_receiver_2(i, v) AL_sete(_entcs, i, v)
        #define entcs_is_self(e) ((e).sv_entnum == player_localentnum - 1)
@@ -82,6 +83,16 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
                return entcs_IsSpectating(i) ? NUM_SPECTATOR : entcs_GetTeamColor(i);
        }
 
+       /**
+        * Same as `entcs_GetTeam`, but returns -1 for no team in teamplay
+        */
+       int entcs_GetScoreTeam(int i)
+       {
+               int t = entcs_GetTeam(i);
+               if (teamplay && !t) t = -1;
+               return t;
+       }
+
        /**
        * @param i zero indexed player
        */