Merge branch 'terencehill/ca_integer_score' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / all.qh
1 #pragma once
2
3 #include <common/command/_mod.qh>
4
5 #include "item.qh"
6
7 // NOTE: 24 is the limit for the .items field
8 REGISTRY(Items, 32)
9 #ifdef GAMEQC
10 REGISTRY_DEPENDS(Items, Models)
11 #endif
12 REGISTER_REGISTRY(Items)
13 #define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
14
15 #ifdef CSQC
16 // Copy Items registry here before it gets sorted alphabetically by REGISTRY_SORT
17 // so we can keep items sorted by categories (as they appear in the code)
18 IntrusiveList default_order_items;
19 STATIC_INIT(default_order_items)
20 {
21         default_order_items = IL_NEW();
22         FOREACH(Items, true, {
23                 IL_PUSH(default_order_items, it);
24         });
25 }
26 #endif
27
28 REGISTRY_SORT(Items)
29 REGISTRY_CHECK(Items)
30
31 REGISTRY_DEFINE_GET(Items, NULL)
32 STATIC_INIT(Items) { FOREACH(Items, true, it.m_id = i); }
33
34 void Dump_Items();
35
36 GENERIC_COMMAND(dumpitems, "Dump all items to the console", false) {
37     switch (request) {
38         case CMD_REQUEST_COMMAND: {
39             Dump_Items();
40             return;
41         }
42         default:
43         case CMD_REQUEST_USAGE: {
44             LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpitems");
45             return;
46         }
47     }
48 }
49
50 #ifdef GAMEQC
51 string Item_Model(string item_mdl);
52 #endif