From: Mario Date: Sun, 21 Aug 2016 09:36:19 +0000 (+1000) Subject: ItemsTime: only loop through items, not every single entity X-Git-Tag: xonotic-v0.8.2~663^2~30 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0838248f8302f02fcceb6de5fc04f9b7407ab63b;p=xonotic%2Fxonotic-data.pk3dir.git ItemsTime: only loop through items, not every single entity --- diff --git a/qcsrc/common/mutators/mutator/itemstime/itemstime.qc b/qcsrc/common/mutators/mutator/itemstime/itemstime.qc index 3fe9de6d7..70587f430 100644 --- a/qcsrc/common/mutators/mutator/itemstime/itemstime.qc +++ b/qcsrc/common/mutators/mutator/itemstime/itemstime.qc @@ -137,11 +137,10 @@ void Item_ItemsTime_SetTimesForAllPlayers() float Item_ItemsTime_UpdateTime(entity e, float t) { bool isavailable = (t == 0); - FOREACH_ENTITY_FLOAT(pure_data, false, + IL_EACH(g_items, it != e, { - if(!(it.itemdef == e.itemdef || ((e.weapons & WEPSET_SUPERWEAPONS) && (it.weapons & WEPSET_SUPERWEAPONS) && clienttype(it) == CLIENTTYPE_NOTACLIENT))) + if(!(it.itemdef == e.itemdef || ((e.weapons & WEPSET_SUPERWEAPONS) && (it.weapons & WEPSET_SUPERWEAPONS)))) continue; - if (e == it) continue; if (it.scheduledrespawntime <= time) isavailable = true; else if (t == 0 || it.scheduledrespawntime < t) @@ -157,11 +156,9 @@ MUTATOR_HOOKFUNCTION(itemstime, reset_map_global) Item_ItemsTime_ResetTimes(); // ALL the times need to be reset before .reset()ing each item // since Item_Reset schedules respawn of superweapons and powerups - FOREACH_ENTITY_FLOAT(pure_data, false, + IL_EACH(g_items, it.reset, { - if(IS_CLIENT(it)) - continue; - if (it.reset) Item_ItemsTime_SetTime(it, 0); + Item_ItemsTime_SetTime(it, 0); }); Item_ItemsTime_SetTimesForAllPlayers(); }