Xonotic
reg.qh
Go to the documentation of this file.
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 }
#define REGISTRY_SORT(...)
Definition: registry.qh:128
#define REGISTER_REGISTRY(id)
Definition: registry.qh:212
#define REGISTRY_DEFINE_GET(id, null)
Definition: registry.qh:40
#define REGISTRY(id, max)
Declare a new registry.
Definition: registry.qh:26
#define NULL
Definition: post.qh:17
STATIC_INIT(GENERIC_COMMANDS_aliases)
Definition: reg.qh:21
#define FOREACH(list, cond, body)
Definition: iter.qh:19
#define BITS(n)
Definition: bits.qh:9