From 891f4589ec8ec305cdc134cc8fa610089ab16c14 Mon Sep 17 00:00:00 2001
From: Mario <mario@smbclan.net>
Date: Sat, 18 Feb 2017 19:44:59 +1000
Subject: [PATCH] Loop through items intrusive list instead of cycling through
 every single entity, should fix a runaway loop counter crash

---
 qcsrc/common/t_items.qc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc
index b6f405fec..00b0dcf12 100644
--- a/qcsrc/common/t_items.qc
+++ b/qcsrc/common/t_items.qc
@@ -1332,7 +1332,7 @@ void setItemGroup(entity this)
 			{
 				int grY = it.item_group;
 				// move all items of item_group Y to item_group X
-				FOREACH_ENTITY(IS_SMALL(it.itemdef),
+				IL_EACH(g_items, IS_SMALL(it.itemdef),
 				{
 					if(it.item_group == grY)
 						it.item_group = this.item_group;
@@ -1347,9 +1347,9 @@ void setItemGroupCount()
 	for (int k = 1; k <= group_count; k++)
 	{
 		int count = 0;
-		FOREACH_ENTITY(IS_SMALL(it.itemdef) && it.item_group == k, { count++; });
+		IL_EACH(g_items, IS_SMALL(it.itemdef) && it.item_group == k, { count++; });
 		if (count)
-			FOREACH_ENTITY(IS_SMALL(it.itemdef) && it.item_group == k, { it.item_group_count = count; });
+			IL_EACH(g_items, IS_SMALL(it.itemdef) && it.item_group == k, { it.item_group_count = count; });
 	}
 }
 
-- 
2.39.5