]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
entcs: use ArrayList
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 23 Nov 2015 05:44:43 +0000 (16:44 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 23 Nov 2015 05:44:43 +0000 (16:44 +1100)
qcsrc/client/shownames.qc
qcsrc/client/view.qc
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/ent_cs.qc
qcsrc/common/ent_cs.qh
qcsrc/common/weapons/weapon/arc.qc

index 38c94ae9f171412325c53836fe47eee7acbc637d..6bcd343b9626e1528781c37573d3bfd99159d19e 100644 (file)
@@ -168,7 +168,7 @@ void Draw_ShowNames_All()
 {
        if (!autocvar_hud_shownames) return;
        LL_EACH(shownames_ent, true, LAMBDA(
-               entity entcs = entcs_receiver[i];
+               entity entcs = entcs_receiver(i);
                if (!entcs) continue;
                if (entcs.m_entcs_private)
                {
index d2f8714adf04852b09a8371a2532dec12d045254..f7474de586f01dfd64d47b4cea8f55e5390c4e20 100644 (file)
@@ -360,7 +360,7 @@ float TrueAimCheck()
                        break;
        }
 
-       vector traceorigin = entcs_receiver[player_localentnum - 1].origin + (eZ * getstati(STAT_VIEWHEIGHT));
+       vector traceorigin = entcs_receiver(player_localentnum - 1).origin + (eZ * getstati(STAT_VIEWHEIGHT));
 
        vecs = decompressShotOrigin(getstati(STAT_SHOTORG));
 
index 44f20b2b9de66460e317729f5372348b6e30a350..d920bd139eab195a99d7013db532e17d1a0bc98e 100644 (file)
@@ -68,7 +68,7 @@
                        float r = ReadByte() / 255;
                        string sample = GlobalSound_sample(gs.m_globalsoundstr, r);
                        int who = ReadByte();
-                       entity e = entcs_receiver[who - 1];
+                       entity e = entcs_receiver(who - 1);
                        int chan = ReadByte();
                        float vol = ReadByte() / 255;
                        float atten = ReadByte() / 64;
@@ -98,7 +98,7 @@
                        entity ps = PlayerSounds_from(ReadByte());
                        float r = ReadByte() / 255;
                        int who = ReadByte();
-                       entity e = entcs_receiver[who - 1];
+                       entity e = entcs_receiver(who - 1);
                        UpdatePlayerSounds(e);
                        string s = e.(ps.m_playersoundfld);
                        string sample = GlobalSound_sample(s, r);
index c30e52af6d628d0f25ed527a540d3354fc956f07..0098dbc5ea2cf26eb63109298443850c8b2cff15 100644 (file)
        void Ent_RemoveEntCS()
        {
                SELFPARAM();
-               entcs_receiver[this.sv_entnum] = NULL;
+               entcs_receiver(this.sv_entnum, NULL);
        }
 
        void entcs_think()
                #define X(public, fld, sv, cl) { if (sf & BIT(i)) cl; } i += 1;
                ENTCS_NETPROPS(X);
        #undef X
-               entcs_receiver[this.sv_entnum] = this;
+               entcs_receiver(this.sv_entnum, this);
                this.iflags |= IFLAG_ORIGIN;
                InterpolateOrigin_Note(this);
                return true;
index 1e82e15634fb919a3d9b0b19a71208e3a8ff77ba..6d9685c4be8dbe86eab14157456166b1ccc3812e 100644 (file)
@@ -40,7 +40,14 @@ void entcs_detach(entity e);
 
 #ifdef CSQC
 
-entity entcs_receiver[255]; // 255 is the engine limit on maxclients
+AL_declare(_entcs);
+STATIC_INIT(_entcs)
+{
+    AL_init(_entcs, 255, NULL, e); // 255 is the engine limit on maxclients
+}
+#define entcs_receiver(...) EVAL(OVERLOAD(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 + 1 == player_localentnum)
 
 #endif
index 78aaa942501b1bab7abfb87b4e92de7adf76ca2d..83d7e3fcbf23ec1ca254557df940f6a94a5fade7 100644 (file)
@@ -1227,7 +1227,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                else
                {
                        // use player origin so that third person display still works
-                       self.origin = entcs_receiver[player_localnum].origin + ('0 0 1' * getstati(STAT_VIEWHEIGHT));
+                       self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * getstati(STAT_VIEWHEIGHT));
                }
        }