]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/command/reg.qh
Create aliases for commands on roughly their correct VM, restores settemp functionality
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / command / reg.qh
index 9868e2490afc54a4affeedf5216b4782d402f188..a6f669fd91e04c461a2710837ae760e070c9523a 100644 (file)
@@ -6,14 +6,17 @@ REGISTRY(GENERIC_COMMANDS, BITS(7))
 REGISTER_REGISTRY(GENERIC_COMMANDS)
 REGISTRY_SORT(GENERIC_COMMANDS)
 
-#define GENERIC_COMMAND(id, description) \
+.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"))));
 }