]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a few checks
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 30 Nov 2015 10:48:54 +0000 (21:48 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 30 Nov 2015 10:48:54 +0000 (21:48 +1100)
qcsrc/client/shownames.qc
qcsrc/lib/oo.qh
qcsrc/lib/registry.qh
qcsrc/server/g_world.qc

index e217e2d31e6bdad5fe4fa0ec2956abebb59acff9..b70714558326bbee3d145cd87e758c7fa7195d4a 100644 (file)
@@ -168,7 +168,12 @@ void Draw_ShowNames_All()
        LL_EACH(shownames_ent, true, LAMBDA(
                entity entcs = entcs_receiver(i);
                if (!entcs) continue;
-               WITH(entity, self, entcs, entcs.think());
+               if (entcs.think) WITH(entity, self, entcs, entcs.think());
+               else
+               {
+                       LOG_WARNING("entcs.think == null");
+                       eprint(entcs);
+               }
                if (entcs.m_entcs_private)
                {
                        it.healthvalue = entcs.healthvalue;
index e7d9a13b101b068f370d7eaf71c93550b7a6da83..d7e9df848865a02039757ba6f92e12d39ecc9b7f 100644 (file)
                (e).pure_data = true; \
        } \
        while (0)
+#define make_impure(e) \
+       do \
+       { \
+               (e).pure_data = false; \
+       } \
+       while (0)
 #define is_pure(e) ((e).pure_data)
 
 .string classname;
@@ -54,13 +60,16 @@ entity _clearentity_ent;
 STATIC_INIT(clearentity)
 {
        _clearentity_ent = new(clearentity);
+       make_pure(_clearentity_ent);
 }
 void clearentity(entity e)
 {
 #ifdef CSQC
                int n = e.entnum;
 #endif
+       bool was_pure = is_pure(e);
        copyentity(_clearentity_ent, e);
+       if (!was_pure) make_impure(e);
 #ifdef CSQC
                e.entnum = n;
 #endif
index 28c32f4432cc2ebf45904f857098f996bcdf24c4..3fc5e48983e673668a22db755cd0d8bb2a1bbd1a 100644 (file)
@@ -82,6 +82,7 @@ REGISTRY(Registries, BITS(8))
 
 #define REGISTRY_RESERVE(registry, fld, id, suffix) do { \
        entity e = new(registry_reserved); \
+       make_pure(e); \
        e.registered_id = #id "/" #suffix; \
        REGISTRY_PUSH(registry, fld, e); \
 } while (0)
index 9587d3cd1e2e4d103109bc77c8f3d21019eecea1..99c0612648375ae7fd05418d67dc89c963750514 100644 (file)
@@ -1416,11 +1416,13 @@ void FixIntermissionClient(entity e)
                if(IS_REAL_CLIENT(e))
                {
                        stuffcmd(e, "\nscr_printspeed 1000000\n");
-                       string list = autocvar_sv_intermission_cdtrack;
-                       for(string it; (it = car(list)); list = cdr(list))
-                               RandomSelection_Add(world, 0, it, 1, 1);
-                       if(RandomSelection_chosen_string && RandomSelection_chosen_string != "")
-                               stuffcmd(e, strcat("\ncd loop ", RandomSelection_chosen_string, "\n"));
+                       FOREACH_WORD(autocvar_sv_intermission_cdtrack, true, LAMBDA(
+                               RandomSelection_Add(NULL, 0, it, 1, 1);
+                       ));
+                       if (RandomSelection_chosen_string != "")
+                       {
+                               stuffcmd(e, sprintf("\ncd loop %s\n", RandomSelection_chosen_string));
+                       }
                        msg_entity = e;
                        WriteByte(MSG_ONE, SVC_INTERMISSION);
                }