]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/command/reg.qh
Merge branch 'master' into Lyberta/KillSound
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / command / reg.qh
1 #pragma once
2
3 #include "command.qh"
4 REGISTRY(GENERIC_COMMANDS, BITS(7))
5 #define GENERIC_COMMANDS_from(i) _GENERIC_COMMANDS_from(i, NULL)
6 REGISTER_REGISTRY(GENERIC_COMMANDS)
7 REGISTRY_SORT(GENERIC_COMMANDS)
8
9 #define GENERIC_COMMAND(id, description) \
10         CLASS(genericcommand_##id, Command) \
11                 ATTRIB(genericcommand_##id, m_name, string, #id); \
12         ATTRIB(genericcommand_##id, m_description, string, description); \
13         ENDCLASS(genericcommand_##id) \
14     REGISTER(GENERIC_COMMANDS, CMD_G, id, m_id, NEW(genericcommand_##id)); \
15         METHOD(genericcommand_##id, m_invokecmd, void(genericcommand_##id this, int request, entity caller, int arguments, string command))
16
17 STATIC_INIT(GENERIC_COMMANDS_aliases) {
18         FOREACH(GENERIC_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svmenu")));
19 }