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