From f5bd5c182811845905f80c8d6edc97b7f99f1de6 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 22 Aug 2016 17:44:59 +1000 Subject: [PATCH] Convey more intrusive lists --- qcsrc/common/t_items.qc | 8 +++----- qcsrc/common/triggers/func/conveyor.qc | 12 ++++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 507ba9e0b..6e4b05a91 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -835,9 +835,8 @@ LABEL(pickup) if(this.team) { RandomSelection_Init(); - FOREACH_ENTITY_FLAGS(flags, FL_ITEM, + IL_EACH(g_items, it.team == this.team, { - if(it.team == this.team) if(it.classname != "item_flag_team" && it.classname != "item_key_team") { Item_Show(it, -1); @@ -1446,10 +1445,9 @@ void target_items_use(entity this, entity actor, entity trigger) EXACTTRIGGER_TOUCH(this, trigger); } - FOREACH_ENTITY_ENT(enemy, actor, + IL_EACH(g_items, it.enemy == actor && it.classname == "droppedweapon", { - if(it.classname == "droppedweapon") - delete(it); + delete(it); }); if(GiveItems(actor, 0, tokenize_console(this.netname))) diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index 4902deea5..d8bc80c36 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -1,6 +1,9 @@ #include "conveyor.qh" REGISTER_NET_LINKED(ENT_CLIENT_CONVEYOR) +IntrusiveList g_conveyed; +STATIC_INIT(g_conveyed) { g_conveyed = IL_NEW(); } + void conveyor_think(entity this) { #ifdef CSQC @@ -11,9 +14,10 @@ void conveyor_think(entity this) #endif // set mythis as current conveyor where possible - FOREACH_ENTITY_ENT(conveyor, this, + IL_EACH(g_conveyed, it.conveyor == this, { it.conveyor = NULL; + IL_REMOVE(g_conveyed, it); }); if(this.state) @@ -29,10 +33,14 @@ void conveyor_think(entity this) } if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate + { + if(!it.conveyor) + IL_PUSH(g_conveyed, it); it.conveyor = this; + } }); - FOREACH_ENTITY_ENT(conveyor, this, + IL_EACH(g_conveyed, it.conveyor == this, { if(IS_CLIENT(it)) // doing it via velocity has quite some advantages continue; // done in SV_PlayerPhysics continue; -- 2.39.2