From 0e19497374dac79f15f85693c09ad3bd7b2dea1f Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 29 Nov 2020 12:47:01 +0100 Subject: [PATCH] Item stats: implement the item filter as a whitelist; also add a note as to why we need a copy of the Items registry --- qcsrc/client/hud/panel/scoreboard.qc | 18 +++++------------- qcsrc/common/items/all.qh | 2 ++ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index c0f1bc6ea..a9f1a67bc 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -1323,20 +1323,12 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size) STATIC_INIT(default_order_items_label) { IL_EACH(default_order_items, true, { - switch(it.netname) + if(!(it.instanceOfPowerup + || it == ITEM_HealthMega || it == ITEM_HealthBig + || it == ITEM_ArmorMega || it == ITEM_ArmorBig + )) { - case "bullets": - case "cells": - case "plasma": - case "rockets": - case "shells": - case "vaporizer_cells": - case "fuel": - case "armor_small": - case "armor_medium": - case "health_small": - case "health_medium": - it.uninteresting = true; + it.uninteresting = true; } }); } diff --git a/qcsrc/common/items/all.qh b/qcsrc/common/items/all.qh index 7134a9947..bb2e387fb 100644 --- a/qcsrc/common/items/all.qh +++ b/qcsrc/common/items/all.qh @@ -13,6 +13,8 @@ REGISTER_REGISTRY(Items) #define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class)) #ifdef CSQC +// Copy Items registry here before it gets sorted alphabetically by REGISTRY_SORT +// so we can keep items sorted by categories (as they appear in the code) IntrusiveList default_order_items; STATIC_INIT(default_order_items) { -- 2.39.2