]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/item.qh
Extract registry functionality
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item.qh
index 507ca93e029c993f00fccf6132e19213f02d48c7..6ecd6d7f7a49fdba67f0271a30d4259dc78e1293 100644 (file)
@@ -2,6 +2,7 @@
 #define GAMEITEM_H
 #include "../oo.qh"
 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
+/** If you register a new item, make sure to add it to all.inc */
 CLASS(GameItem, Object)
     ATTRIB(GameItem, m_id, int, 0)
     METHOD(GameItem, show, void(entity this))
@@ -9,19 +10,4 @@ CLASS(GameItem, Object)
     void ITEM_HANDLE(Show, entity this) { this.show(this); }
 ENDCLASS(GameItem)
 
-
-int ITEM_COUNT;
-/** If you register a new item, make sure to add it to all.inc */
-#define REGISTER_ITEM(id, class)                \
-    entity ITEM_##id;                           \
-    void RegisterItems_init_##id(entity this) {} \
-    void RegisterItems_##id() {                 \
-        entity this = NEW(class);               \
-        ITEM_##id = this;                       \
-        this.m_id = ITEM_COUNT;                 \
-        ITEMS[ITEM_COUNT++] = this;             \
-        RegisterItems_init_##id(this);          \
-    }                                           \
-    ACCUMULATE_FUNCTION(RegisterItems, RegisterItems_##id) \
-    [[accumulate]] void RegisterItems_init_##id(entity this)
 #endif