X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fitems%2Fall.qh;h=ab86ea6736eaca2b592cb6e212bdc1aa6b42392b;hp=7290b95a90f1c26c3509198193b8bdb98b4d3060;hb=c741e6b3f012aa525f23e1df30d1d933b383fbc5;hpb=7ac9ebe0d7ea2238a58288af1c8891103455b5f3 diff --git a/qcsrc/common/items/all.qh b/qcsrc/common/items/all.qh index 7290b95a9..ab86ea673 100644 --- a/qcsrc/common/items/all.qh +++ b/qcsrc/common/items/all.qh @@ -1,38 +1,38 @@ -#ifndef ALL_H -#define ALL_H +#ifndef ITEMS_ALL_H +#define ITEMS_ALL_H -const int MAX_ITEMS = 23; -entity ITEMS[MAX_ITEMS]; +#include "../command/all.qh" -#define ITEMS_FOREACH(pred, body) do { \ - for (int i = 0; i < ITEM_COUNT; i++) { \ - const entity it = ITEMS[i]; \ - if (pred) { body } \ - } \ -} while(0) +#include "item.qh" + +REGISTRY(Items, BITS(5)) +#define Items_from(i) _Items_from(i, NULL) +REGISTER_REGISTRY(Items) +/** If you register a new item, make sure to add it to all.inc */ +#define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class)) + +REGISTRY_SORT(Items, 0) +REGISTRY_CHECK(Items) +STATIC_INIT(Items) { FOREACH(Items, true, LAMBDA(it.m_id = i)); } -void RegisterItems(); void Dump_Items(); -#ifdef CSQC -void ReadItems() -{ -/* - const int flags = read(); - for (int i = 0; i < MAX_ITEMS; i++) { - if (flags & BIT(i)) { - self.items[i] = read(); +GENERIC_COMMAND(dumpitems, "Dump all items to the console") { + switch (request) { + case CMD_REQUEST_COMMAND: { + Dump_Items(); + return; + } + default: + case CMD_REQUEST_USAGE: { + LOG_INFOF("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix()); + return; } } -*/ } -#endif - -#ifdef SVQC -void WriteItems() -{ -} +#ifndef MENUQC +string Item_Model(string item_mdl); #endif #endif