From: Samual Date: Fri, 16 Dec 2011 15:42:09 +0000 (-0500) Subject: "handlevote" system, to work with old uid2name stuff X-Git-Tag: xonotic-v0.6.0~188^2~28^2~131 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3b49f7a76209b90440acc8cf0f24aeeb45cc7d41;p=xonotic%2Fxonotic-data.pk3dir.git "handlevote" system, to work with old uid2name stuff --- diff --git a/commands.cfg b/commands.cfg index 25318b675..329353e6b 100644 --- a/commands.cfg +++ b/commands.cfg @@ -239,8 +239,8 @@ alias vstop "cmd vote stop" alias vmaster "cmd vote master" alias vlogin "cmd vote login ${* ?}" alias vdo "cmd vote do ${* ?}" -alias vyes "cl_cmd vyes" -alias vno "cl_cmd vno" +alias vyes "cl_cmd handlevote yes" +alias vno "cl_cmd handlevote no" alias vdontcare "cmd vote dontcare" alias vabstain "cmd vote abstain" diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index d995f241a..e403623e8 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -156,6 +156,49 @@ void GameCommand_debugmodel(float request, float argc) } } +void GameCommand_handlevote(float request, float argc) +{ + switch(request) + { + case CMD_REQUEST_COMMAND: + { + float vote_selection; + string vote_string; + + switch(argv(1)) + { + case "yes": vote_selection = 2; vote_string = "yes"; break; + case "no": vote_selection = 1; vote_string = "no"; break; + default: break; + } + + if(vote_selection) + { + if(uid2name_dialog) // handled by "uid2name" option + { + vote_active = 0; + vote_prev = 0; + vote_change = -9999; + localcmd(strcat("setreport cl_allow_uid2name ", ftos(vote_selection - 1), "\n")); + uid2name_dialog = 0; + } + else { localcmd(strcat("cmd vote ", vote_string, "\n")); } + + return; + } + } + + default: + print("Incorrect parameters for ^2handlevote^7\n"); + case CMD_REQUEST_USAGE: + { + print("\nUsage:^3 cl_cmd handlevote vote\n"); + print(" Where 'vote' is the selection for either the current poll or uid2name.\n"); + return; + } + } +} + void GameCommand_hud(float request, float argc) // TODO: Add aliases in commands.cfg { switch(request) @@ -344,6 +387,7 @@ void GameCommand_(float request) #define CLIENT_COMMANDS(request,arguments) \ CLIENT_COMMAND("blurtest", GameCommand_blurtest(request), "Feature for testing blur postprocessing") \ CLIENT_COMMAND("debugmodel", GameCommand_debugmodel(request, arguments), "Spawn a debug model manually") \ + CLIENT_COMMAND("handlevote", GameCommand_handlevote(request, arguments), "System to handle selecting a vote or option") \ CLIENT_COMMAND("hud", GameCommand_hud(request, arguments), "Commands regarding/controlling the HUD system") \ CLIENT_COMMAND("mv_download", GameCommand_mv_download(request, arguments), "Retrieve mapshot picture from the server") \ CLIENT_COMMAND("sendcvar", GameCommand_sendcvar(request, arguments), "Send a cvar to the server (like weaponpriority)") \