From: terencehill Date: Tue, 9 Jun 2020 15:50:44 +0000 (+0200) Subject: Automatically get the command name in the "Incorrect parameters ..." messages X-Git-Tag: xonotic-v0.8.5~926 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bbd6fbcb695b11ee8b58f8536d53e600d8cbfcd7;p=xonotic%2Fxonotic-data.pk3dir.git Automatically get the command name in the "Incorrect parameters ..." messages --- diff --git a/qcsrc/client/commands/cl_cmd.qc b/qcsrc/client/commands/cl_cmd.qc index 350836e2b..7735815d5 100644 --- a/qcsrc/client/commands/cl_cmd.qc +++ b/qcsrc/client/commands/cl_cmd.qc @@ -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 "); diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 3405ecd64..bd149e789 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -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\""); diff --git a/qcsrc/common/debug.qh b/qcsrc/common/debug.qh index c09741a01..49b6a5787 100644 --- a/qcsrc/common/debug.qh +++ b/qcsrc/common/debug.qh @@ -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\""); diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index 2296ef138..1dac610ed 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -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"); diff --git a/qcsrc/server/command/banning.qc b/qcsrc/server/command/banning.qc index 7607ced74..42de51882 100644 --- a/qcsrc/server/command/banning.qc +++ b/qcsrc/server/command/banning.qc @@ -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"); diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index c73473534..925a16012 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -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 \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 \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 \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 \n"); diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index eb1be6d9a..62edb992f 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -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]");