Registry: use BITS everywhere
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / all.qh
1 #ifndef ITEMS_ALL_H
2 #define ITEMS_ALL_H
3
4 #include "../command/all.qh"
5
6 #include "item.qh"
7
8 REGISTRY(Items, BITS(5))
9 REGISTER_REGISTRY(RegisterItems)
10 /** If you register a new item, make sure to add it to all.inc */
11 #define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, Items, id, m_id, NEW(class))
12
13 REGISTRY_SORT(Items, m_name, 0)
14 STATIC_INIT(Items) { FOREACH(Items, true, LAMBDA(it.m_id = i)); }
15
16 void Dump_Items();
17
18 GENERIC_COMMAND(dumpitems, "Dump all items to the console") {
19     switch (request) {
20         case CMD_REQUEST_COMMAND: {
21             Dump_Items();
22             return;
23         }
24         default:
25         case CMD_REQUEST_USAGE: {
26             LOG_INFOF("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix());
27             return;
28         }
29     }
30 }
31
32 #ifndef MENUQC
33 string Item_Model(string item_mdl);
34 #endif
35
36 #endif