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
3#include "command.qh"
4REGISTRY(GENERIC_COMMANDS, BITS(7))
5REGISTER_REGISTRY(GENERIC_COMMANDS)
6REGISTRY_SORT(GENERIC_COMMANDS)
7
8REGISTRY_DEFINE_GET(GENERIC_COMMANDS, NULL)
9
10.bool m_menubased; // switch to tell whether this alias should be registered as a menu or client based command
11
12#define GENERIC_COMMAND(id, description, menubased) \
13 CLASS(genericcommand_##id, Command) \
14 ATTRIB(genericcommand_##id, m_name, string, #id); \
15 ATTRIB(genericcommand_##id, m_description, string, description); \
16 ATTRIB(genericcommand_##id, m_menubased, bool, menubased); \
17 ENDCLASS(genericcommand_##id) \
18 REGISTER(GENERIC_COMMANDS, CMD_G, id, m_id, NEW(genericcommand_##id)); \
19 METHOD(genericcommand_##id, m_invokecmd, void(genericcommand_##id this, int request, entity caller, int arguments, string command))
20
21STATIC_INIT(GENERIC_COMMANDS_aliases) {
22 FOREACH(GENERIC_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, ((it.m_menubased) ? "qc_cmd_svmenu" : "qc_cmd_svcl"))));
23}
#define BITS(n)
Definition bits.qh:9
bool m_menubased
Definition reg.qh:10
#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