]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/registry.qh
Merge branch 'master' into terencehill/menu_listbox_changes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / registry.qh
1 #ifndef REGISTRY_H
2 #define REGISTRY_H
3
4 #define REGISTER(initfunc, ns, array, counter, id, class)           \
5     entity ns##_##id;                                               \
6     void Register_##ns##_##id##_init(entity this) { }               \
7     void Register_##ns##_##id() {                                   \
8         entity this = NEW(class);                                   \
9         ns##_##id = this;                                           \
10         this.m_id = ns##_COUNT;                                     \
11         array[counter++] = this;                                    \
12         Register_##ns##_##id##_init(this);                          \
13     }                                                               \
14     ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id)             \
15     [[accumulate]] void Register_##ns##_##id##_init(entity this)
16
17 #endif