From: TimePath Date: Mon, 30 Nov 2015 10:48:54 +0000 (+1100) Subject: Add a few checks X-Git-Tag: xonotic-v0.8.2~1600 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=957c7348e5e7552c61adae9f454e0a15ab99c153;p=xonotic%2Fxonotic-data.pk3dir.git Add a few checks --- diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index e217e2d31..b70714558 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -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; diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index e7d9a13b1..d7e9df848 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -19,6 +19,12 @@ (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 diff --git a/qcsrc/lib/registry.qh b/qcsrc/lib/registry.qh index 28c32f443..3fc5e4898 100644 --- a/qcsrc/lib/registry.qh +++ b/qcsrc/lib/registry.qh @@ -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) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 9587d3cd1..99c061264 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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); }