]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/command/reg.qh
Rename t_items.qc to items.qc
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / command / reg.qh
index 9868e2490afc54a4affeedf5216b4782d402f188..abb40b509de08165e613a1eae1f7c6b32c7ef06d 100644 (file)
@@ -2,18 +2,22 @@
 
 #include "command.qh"
 REGISTRY(GENERIC_COMMANDS, BITS(7))
-#define GENERIC_COMMANDS_from(i) _GENERIC_COMMANDS_from(i, NULL)
 REGISTER_REGISTRY(GENERIC_COMMANDS)
 REGISTRY_SORT(GENERIC_COMMANDS)
 
-#define GENERIC_COMMAND(id, description) \
+REGISTRY_DEFINE_GET(GENERIC_COMMANDS, NULL)
+
+.bool m_menubased; // switch to tell whether this alias should be registered as a menu or client based command
+
+#define GENERIC_COMMAND(id, description, menubased) \
        CLASS(genericcommand_##id, Command) \
                ATTRIB(genericcommand_##id, m_name, string, #id); \
        ATTRIB(genericcommand_##id, m_description, string, description); \
+       ATTRIB(genericcommand_##id, m_menubased, bool, menubased); \
        ENDCLASS(genericcommand_##id) \
     REGISTER(GENERIC_COMMANDS, CMD_G, id, m_id, NEW(genericcommand_##id)); \
        METHOD(genericcommand_##id, m_invokecmd, void(genericcommand_##id this, int request, entity caller, int arguments, string command))
 
 STATIC_INIT(GENERIC_COMMANDS_aliases) {
-       FOREACH(GENERIC_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svmenu")));
+       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"))));
 }