Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
reg.qh
Go to the documentation of this file.
1#pragma once
2
3REGISTRY(SERVER_COMMANDS, BITS(7))
4REGISTER_REGISTRY(SERVER_COMMANDS)
5REGISTRY_SORT(SERVER_COMMANDS)
6
7REGISTRY_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
17STATIC_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}
20
21REGISTRY(CLIENT_COMMANDS, 64)
22REGISTER_REGISTRY(CLIENT_COMMANDS)
23REGISTRY_SORT(CLIENT_COMMANDS)
24
25REGISTRY_DEFINE_GET(CLIENT_COMMANDS, NULL)
26
27#define CLIENT_COMMAND(id, description) \
28 CLASS(clientcommand_##id, Command) \
29 ATTRIB(clientcommand_##id, m_name, string, #id); \
30 ATTRIB(clientcommand_##id, m_description, string, description); \
31 ENDCLASS(clientcommand_##id) \
32 REGISTER(CLIENT_COMMANDS, CMD_SVCL, id, m_id, NEW(clientcommand_##id)); \
33 METHOD(clientcommand_##id, m_invokecmd, void(clientcommand_##id this, int request, entity caller, int arguments, string command))
#define BITS(n)
Definition bits.qh:9
#define FOREACH(list, cond, body)
Definition iter.qh:19
void localcmd(string command,...)
#define NULL
Definition post.qh:14
#define REGISTRY_SORT(...)
Definition registry.qh:128
#define REGISTER_REGISTRY(id)
Definition registry.qh:229
#define REGISTRY(id, max)
Declare a new registry.
Definition registry.qh:26
#define REGISTRY_DEFINE_GET(id, null)
Definition registry.qh:40
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:32