]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Create aliases for commands on roughly their correct VM, restores settemp functionality
authorMario <mario.mario@y7mail.com>
Sat, 28 Dec 2019 13:25:05 +0000 (23:25 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 28 Dec 2019 13:25:05 +0000 (23:25 +1000)
qcsrc/common/command/generic.qc
qcsrc/common/command/reg.qh
qcsrc/common/debug.qh
qcsrc/common/effects/effectinfo.qc
qcsrc/common/items/all.qh
qcsrc/common/notifications/all.qh
qcsrc/common/turrets/all.qh
qcsrc/common/weapons/all.qh
qcsrc/lib/matrix/command.qc

index dcd8d958422b660a941e639fbb23d6eb82de838a..2c34fea44a50813493007c2c2cedc1f88840025a 100644 (file)
@@ -169,7 +169,7 @@ void GenericCommand_qc_curl(int request, int argc)
        }
 }
 
-GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to <program>_cmd_dump.txt")
+GENERIC_COMMAND(dumpcommands, "Dump all commands on the program to <program>_cmd_dump.txt", false)
 {
        switch(request)
        {
@@ -532,16 +532,16 @@ void GenericCommand_(int request)
 */
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-GENERIC_COMMAND(addtolist, "Add a string to a cvar") { GenericCommand_addtolist(request, arguments); }
-GENERIC_COMMAND(maplist, "Automatic control of maplist") { GenericCommand_maplist(request, arguments); }
-GENERIC_COMMAND(nextframe, "Execute the given command next frame of this VM") { GenericCommand_nextframe(request, command); }
-GENERIC_COMMAND(qc_curl, "Queries a URL") { GenericCommand_qc_curl(request, arguments); }
-GENERIC_COMMAND(removefromlist, "Remove a string from a cvar") { GenericCommand_removefromlist(request, arguments); }
-GENERIC_COMMAND(restartnotifs, "Re-initialize all notifications") { GenericCommand_restartnotifs(request); }
-GENERIC_COMMAND(rpn, "RPN calculator") { GenericCommand_rpn(request, arguments, command); }
-GENERIC_COMMAND(settemp, "Temporarily set a value to a cvar which is restored later") { GenericCommand_settemp(request, arguments); }
-GENERIC_COMMAND(settemp_restore, "Restore all cvars set by settemp command") { GenericCommand_settemp_restore(request); }
-GENERIC_COMMAND(runtest, "Run unit tests") { GenericCommand_runtest(request, arguments); }
+GENERIC_COMMAND(addtolist, "Add a string to a cvar", true) { GenericCommand_addtolist(request, arguments); }
+GENERIC_COMMAND(maplist, "Automatic control of maplist", true) { GenericCommand_maplist(request, arguments); }
+GENERIC_COMMAND(nextframe, "Execute the given command next frame of this VM", true) { GenericCommand_nextframe(request, command); }
+GENERIC_COMMAND(qc_curl, "Queries a URL", true) { GenericCommand_qc_curl(request, arguments); }
+GENERIC_COMMAND(removefromlist, "Remove a string from a cvar", true) { GenericCommand_removefromlist(request, arguments); }
+GENERIC_COMMAND(restartnotifs, "Re-initialize all notifications", false) { GenericCommand_restartnotifs(request); }
+GENERIC_COMMAND(rpn, "RPN calculator", true) { GenericCommand_rpn(request, arguments, command); }
+GENERIC_COMMAND(settemp, "Temporarily set a value to a cvar which is restored later", false) { GenericCommand_settemp(request, arguments); }
+GENERIC_COMMAND(settemp_restore, "Restore all cvars set by settemp command", false) { GenericCommand_settemp_restore(request); }
+GENERIC_COMMAND(runtest, "Run unit tests", false) { GenericCommand_runtest(request, arguments); }
 
 void GenericCommand_macro_help()
 {
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"))));
 }
index 05064ca96742c395ab0beb863f6bffb186549867..c95bb2d73cf95e458a66485679e06b74f79357e5 100644 (file)
@@ -197,7 +197,7 @@ bool autocvar_debugdraw;
 #endif
 
 
-GENERIC_COMMAND(bufstr_get, "Examine a string buffer object")
+GENERIC_COMMAND(bufstr_get, "Examine a string buffer object", false)
 {
        switch (request)
        {
@@ -219,7 +219,7 @@ GENERIC_COMMAND(bufstr_get, "Examine a string buffer object")
 }
 
 
-GENERIC_COMMAND(version, "Print the current version")
+GENERIC_COMMAND(version, "Print the current version", false)
 {
        switch (request)
        {
@@ -241,7 +241,7 @@ GENERIC_COMMAND(version, "Print the current version")
 #ifdef CSQC
 void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
 #endif
-GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars")
+GENERIC_COMMAND(cvar_localchanges, "Print locally changed cvars", false)
 {
        switch (request)
        {
@@ -332,7 +332,7 @@ STATIC_INIT(TRACE_ENT)
 #endif
 
 
-GENERIC_COMMAND(find, "Search through entities for matching classname")
+GENERIC_COMMAND(find, "Search through entities for matching classname", false)
 {
        switch (request)
        {
@@ -363,7 +363,7 @@ GENERIC_COMMAND(find, "Search through entities for matching classname")
 }
 
 
-GENERIC_COMMAND(findat, "Search through entities for matching origin")
+GENERIC_COMMAND(findat, "Search through entities for matching origin", false)
 {
        switch (request)
        {
index 68c245db4a7df2674b7ceb79ddd061234b3ff7fd..79d31eb46bc5efdb473e4322a02b985101511401 100644 (file)
@@ -285,7 +285,7 @@ void effectinfo_dump(int fh, bool alsoprint)
     #undef WRITE
 }
 
-GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
+GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt", false)
 {
     switch (request) {
         case CMD_REQUEST_COMMAND: {
index 3ff4a54155a3cccaf0ea91b69a38a02ac90c15dc..3ae473503db46e24d8f8877a2fb05cd998142082 100644 (file)
@@ -19,7 +19,7 @@ STATIC_INIT(Items) { FOREACH(Items, true, it.m_id = i); }
 
 void Dump_Items();
 
-GENERIC_COMMAND(dumpitems, "Dump all items to the console") {
+GENERIC_COMMAND(dumpitems, "Dump all items to the console", false) {
     switch (request) {
         case CMD_REQUEST_COMMAND: {
             Dump_Items();
index e9ddf429cdf7fd5a439467fc70b048f4d2960db8..7c341293b958fba3bc963d59eaa65f727553ec79 100644 (file)
@@ -160,7 +160,7 @@ void Create_Notification_Entity_Choice(entity notif,
 
 void Dump_Notifications(int fh, bool alsoprint);
 
-GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt")
+GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt", false)
 {
        switch (request)
        {
index 3d0528a2511825742d89fd27ac0ecfc727a1d440..9dedc89cb780253a184b45ed3f1dba2da1744d9b 100644 (file)
@@ -57,7 +57,7 @@ REGISTRY_CHECK(Turrets)
        #define TR_CONFIG_END()
 #endif
 
-GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
+GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt", false)
 {
     switch(request)
     {
index 0be413f0fb0071fad8974f2022e50cea7a1bf838..131e7b49efa03a21044d505f157f768cea70ad47 100644 (file)
@@ -38,7 +38,7 @@ STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, it.m_pickup = NEW(WeaponPicku
 #define WepSet_FromWeapon(it) ((it).m_wepset)
 WepSet _WepSet_FromWeapon(int i);
 
-GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPONTODO: make this work with other progs than just server
+GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt", false) // WEAPONTODO: make this work with other progs than just server
 {
     switch(request)
     {
index 1b58eb1b9fcf75d0ddd7196843a6cb5be402d695..0cfe564f0792461ed0264663041eae2340cdc5f8 100644 (file)
@@ -2,7 +2,7 @@
 
 #include <common/command/_mod.qh>
 
-GENERIC_COMMAND(mx, "Send a matrix command") {
+GENERIC_COMMAND(mx, "Send a matrix command", false) {
     switch (argv(1)) {
         case "user":
             strcpy(matrix_user, substring(command, argv_start_index(2), -1));