]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
"handlevote" system, to work with old uid2name stuff
authorSamual <samual@xonotic.org>
Fri, 16 Dec 2011 15:42:09 +0000 (10:42 -0500)
committerSamual <samual@xonotic.org>
Fri, 16 Dec 2011 15:42:09 +0000 (10:42 -0500)
commands.cfg
qcsrc/client/command/cl_cmd.qc

index 25318b675fac2c1e99b3037805d637634d862c0e..329353e6bce9a2f289c4117f3f50de1d3a7fc564 100644 (file)
@@ -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"
 
index d995f241ade0a86951de03af45f3a3c79af0a505..e403623e8fed1317c0683b18170e1ea7ea0765d9 100644 (file)
@@ -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)") \