Inventory system
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item.qh
index 6ca1314..da4e7a4 100644 (file)
@@ -3,6 +3,7 @@
 #include "../oo.qh"
 #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
 CLASS(GameItem, Object)
+    ATTRIB(GameItem, m_id, int, 0)
     METHOD(GameItem, show, void(entity this))
     void GameItem_show(entity this) { print("A game item\n"); }
     void ITEM_HANDLE(Show, entity this) { this.show(this); }
@@ -15,6 +16,7 @@ int ITEM_COUNT;
     void RegisterItems_##id() {                 \
         const entity this = NEW(class);         \
         ITEM_##id = this;                       \
+        this.m_id = ITEM_COUNT;                 \
         ITEMS[ITEM_COUNT++] = this;             \
         body                                    \
     }                                           \