]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/resources/resources.qh
Clean up ammo sorting in the HUD to not reference items directly
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / resources / resources.qh
index 0ecd29da2779ce403619bf02dde0a594785f7cb5..fa7ce8b73bf448e928a254fb1f62e687d581e0fc 100644 (file)
@@ -35,6 +35,20 @@ ENDCLASS(Resource)
 #define REGISTER_RESOURCE(id, inst) REGISTER(Resources, RES, id, m_id, inst)
 REGISTRY(Resources, BITS(4));
 REGISTER_REGISTRY(Resources)
+
+#ifdef CSQC
+// Copy Resources registry here before it gets sorted alphabetically by REGISTRY_SORT
+// so we can keep resources sorted by categories (as they appear in the code)
+IntrusiveList default_order_resources;
+STATIC_INIT(default_order_resources)
+{
+       default_order_resources = IL_NEW();
+       FOREACH(Resources, true, {
+               IL_PUSH(default_order_resources, it);
+       });
+}
+#endif
+
 REGISTRY_SORT(Resources);
 REGISTRY_CHECK(Resources);