]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/command/reg.qh
Merge branch 'master' into martin-t/defaults
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / reg.qh
1 #pragma once
2
3 REGISTRY(SERVER_COMMANDS, BITS(7))
4 #define SERVER_COMMANDS_from(i) _SERVER_COMMANDS_from(i, NULL)
5 REGISTER_REGISTRY(SERVER_COMMANDS)
6 REGISTRY_SORT(SERVER_COMMANDS)
7
8 #define SERVER_COMMAND(id, description) \
9         CLASS(servercommand_##id, Command) \
10                 ATTRIB(servercommand_##id, m_name, string, #id); \
11         ATTRIB(servercommand_##id, m_description, string, description); \
12         ENDCLASS(servercommand_##id) \
13     REGISTER(SERVER_COMMANDS, CMD_SV, id, m_id, NEW(servercommand_##id)); \
14         METHOD(servercommand_##id, m_invokecmd, void(servercommand_##id this, int request, entity caller, int arguments, string command))
15
16 STATIC_INIT(SERVER_COMMANDS_aliases) {
17         FOREACH(SERVER_COMMANDS, true, { localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv")); });
18 }