]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Automatically get the command name in the "Incorrect parameters ..." messages
authorterencehill <piuntn@gmail.com>
Tue, 9 Jun 2020 15:50:44 +0000 (17:50 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 9 Jun 2020 15:50:44 +0000 (17:50 +0200)
qcsrc/client/commands/cl_cmd.qc
qcsrc/common/command/generic.qc
qcsrc/common/debug.qh
qcsrc/common/weapons/all.qc
qcsrc/server/command/banning.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/sv_cmd.qc

index 350836e2b45eee63a1055624c1e92baf9dbc5337..7735815d57f048e1c22920d2942ac984d19c2d8a 100644 (file)
@@ -108,13 +108,11 @@ void LocalCommand_boxparticles(int request, int argc)
                }
 
                default:
-               {
-                       LOG_INFO("Incorrect parameters for ^2boxparticles^7");
-               }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP(
-                               "Usage:^3 lv_cmd boxparticles effectname own org_from org_to, dir_from, dir_to, countmultiplier, flags\n"
+                               "Usage:^3 cl_cmd boxparticles effectname own org_from org_to, dir_from, dir_to, countmultiplier, flags\n"
                                "  'effectname' is the name of a particle effect in effectinfo.txt\n"
                                "  'own' is the entity number of the owner (negative for csqc ent, positive for svqc ent)\n"
                                "  'org_from' is the starting origin of the box\n"
@@ -241,9 +239,7 @@ void LocalCommand_handlevote(int request, int argc)
                }
 
                default:
-               {
-                       LOG_INFO("Incorrect parameters for ^2handlevote^7");
-               }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 cl_cmd handlevote vote");
@@ -333,9 +329,7 @@ void LocalCommand_hud(int request, int argc)
                }
 
                default:
-               {
-                       LOG_INFO("Incorrect parameters for ^2hud^7");
-               }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 cl_cmd hud action [configname | radartoggle | layout]");
@@ -364,9 +358,7 @@ void LocalCommand_localprint(int request, int argc)
                }
 
                default:
-               {
-                       LOG_INFO("Incorrect parameters for ^2localprint^7");
-               }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 cl_cmd localprint \"message\"");
@@ -391,9 +383,7 @@ void LocalCommand_mv_download(int request, int argc)
                }
 
                default:
-               {
-                       LOG_INFO("Incorrect parameters for ^2mv_download^7");
-               }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 cl_cmd mv_download mapid");
@@ -428,9 +418,7 @@ void LocalCommand_sendcvar(int request, int argc)
                }
 
                default:
-               {
-                       LOG_INFO("Incorrect parameters for ^2sendcvar^7");
-               }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 cl_cmd sendcvar <cvar>");
index 3405ecd64ecc0bd772c42976eb17fbe1ba46ae2d..bd149e7895139f2ea021d73bca8c24642c9cc749 100644 (file)
@@ -86,7 +86,7 @@ void GenericCommand_addtolist(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2addtolist^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " addtolist variable value");
@@ -300,7 +300,7 @@ void GenericCommand_maplist(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2maplist^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " maplist action [map]");
@@ -356,7 +356,7 @@ void GenericCommand_removefromlist(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2removefromlist^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value");
@@ -444,7 +444,7 @@ void GenericCommand_settemp(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2settemp^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " settemp \"cvar\" \"arguments\"");
index c09741a018b08620ba855e75d0020fa8ba4acd68..49b6a5787a2ddd0e1301448b78b2062523bd10bf 100644 (file)
@@ -353,9 +353,7 @@ GENERIC_COMMAND(find, "Search through entities for matching classname", false)
                }
 
                default:
-               {
-                       LOG_INFO("Incorrect parameters for ^2find^7");
-        }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " find classname");
@@ -378,7 +376,7 @@ GENERIC_COMMAND(findat, "Search through entities for matching origin", false)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2findat^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 " GetProgramCommandPrefix() " findat \"x y z\"");
index 2296ef1389613feb1eaddd154fdbdb7f6d99d70a..1dac610ed50e482c1938b0b023d6c6cee0c9b3c7 100644 (file)
@@ -660,9 +660,7 @@ CLIENT_COMMAND(weapon_find, "Show spawn locations of a weapon")
                        });
                }
                default:
-               {
-                       LOG_INFOF("Incorrect parameters for ^2%s^7", "weapon_find");
-               }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 cl_cmd weapon_find weapon");
index 7607ced7406c8ce227fa159f6e099d9f6d4e7fab..42de51882e81d8f6f39d2d1585875028604ea3db 100644 (file)
@@ -41,7 +41,7 @@ void BanCommand_ban(int request, int argc, string command)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2ban^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd ban address [bantime] [reason]");
@@ -108,7 +108,7 @@ void BanCommand_kickban(int request, int argc, string command)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2kickban^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd kickban client [bantime] [masksize] [reason]");
@@ -146,7 +146,7 @@ void BanCommand_mute(int request, int argc, string command)  // TODO: Add a sort
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2mute^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd mute client");
@@ -227,7 +227,7 @@ void BanCommand_unmute(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2mute^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd unmute client");
index c7347353446883ea77337e4bb67ec5a934e4880b..925a16012e735c58d3ae0c71d8ed6c995fa56e26 100644 (file)
@@ -90,7 +90,7 @@ void ClientCommand_autoswitch(entity caller, int request, int argc)
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2autoswitch^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd autoswitch selection\n");
@@ -133,7 +133,7 @@ void ClientCommand_clientversion(entity caller, int request, int argc)  // inter
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2clientversion^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd clientversion version\n");
@@ -158,7 +158,7 @@ void ClientCommand_mv_getpicture(entity caller, int request, int argc)  // inter
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2mv_getpicture^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd mv_getpicture mapid\n");
@@ -248,7 +248,7 @@ void ClientCommand_wpeditor(entity caller, int request, int argc)
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2wpeditor^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd wpeditor action\n");
@@ -561,7 +561,7 @@ void ClientCommand_selectteam(entity caller, int request, int argc)
                        return;
                }
                default:
-                       sprint(caller, "Incorrect parameters for ^2selectteam^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd selectteam team\n");
@@ -586,7 +586,7 @@ void ClientCommand_selfstuff(entity caller, int request, string command)
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2selfstuff^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd selfstuff <command>\n");
@@ -620,7 +620,7 @@ void ClientCommand_sentcvar(entity caller, int request, int argc, string command
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2sentcvar^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd sentcvar <cvar>\n");
@@ -691,7 +691,7 @@ void ClientCommand_suggestmap(entity caller, int request, int argc)
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2suggestmap^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd suggestmap map\n");
@@ -748,7 +748,7 @@ void ClientCommand_tell(entity caller, int request, int argc, string command)
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2tell^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd tell client <message>\n");
@@ -794,7 +794,7 @@ void ClientCommand_voice(entity caller, int request, int argc, string command)
                }
 
                default:
-                       sprint(caller, "Incorrect parameters for ^2voice^7\n");
+                       sprint(caller, sprintf("Incorrect parameters for ^2%s^7\n", argv(0)));
                case CMD_REQUEST_USAGE:
                {
                        sprint(caller, "\nUsage:^3 cmd voice messagetype <soundname>\n");
index eb1be6d9a7bee37181cd0dada7b6c70f9ee790e1..62edb992f9749b723ab8c559d979c5280f098aa9 100644 (file)
@@ -146,7 +146,7 @@ void GameCommand_adminmsg(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2adminmsg^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd adminmsg clients \"message\" [infobartime]");
@@ -230,7 +230,7 @@ void GameCommand_anticheat(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2anticheat^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd anticheat client");
@@ -432,7 +432,7 @@ void GameCommand_bot_cmd(int request, int argc, string command)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2bot_cmd^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd bot_cmd client command [argument]");
@@ -502,7 +502,7 @@ void GameCommand_database(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2database^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd database action filename");
@@ -540,7 +540,7 @@ void GameCommand_defer_clear(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2defer_clear^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd defer_clear client");
@@ -595,7 +595,7 @@ void GameCommand_delrec(int request, int argc)  // perhaps merge later with reco
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2delrec^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd delrec ranking [map]");
@@ -753,7 +753,7 @@ void GameCommand_gametype(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2gametype^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd gametype mode");
@@ -819,7 +819,7 @@ void GameCommand_gettaginfo(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2gettaginfo^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd gettaginfo model frame index [command one] [command two]");
@@ -878,7 +878,7 @@ void GameCommand_animbench(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2gettaginfo^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd gettaginfo model frame index [command one] [command two]");
@@ -902,7 +902,7 @@ void GameCommand_gotomap(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2gotomap^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd gotomap map");
@@ -1099,7 +1099,7 @@ void GameCommand_moveplayer(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2moveplayer^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd moveplayer clients destination");
@@ -1174,7 +1174,7 @@ void GameCommand_radarmap(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2radarmap^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd radarmap [--force] [--loop] [--quit] [--block | --trace | --sample | --lineblock] [--sharpen N] [--res W H] [--qual Q]");
@@ -1224,7 +1224,7 @@ void GameCommand_setbots(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2setbots^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd setbots botnumber");
@@ -1335,7 +1335,7 @@ void GameCommand_stuffto(int request, int argc)
                        }
 
                        default:
-                               LOG_INFO("Incorrect parameters for ^2stuffto^7");
+                               LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                        case CMD_REQUEST_USAGE:
                        {
                                LOG_HELP("Usage:^3 sv_cmd stuffto client \"command\"");
@@ -1516,7 +1516,7 @@ void GameCommand_trace(int request, int argc)
                }
 
                default:
-                       LOG_INFO("Incorrect parameters for ^2trace^7");
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                        LOG_HELP("Usage:^3 sv_cmd trace command [startpos endpos] [endpos_height]");