]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Compatibility with 0.5 for voting, plus fix player/world entity for common commands
authorSamual <samual@xonotic.org>
Thu, 29 Dec 2011 00:19:30 +0000 (19:19 -0500)
committerSamual <samual@xonotic.org>
Thu, 29 Dec 2011 00:19:30 +0000 (19:19 -0500)
qcsrc/client/command/cl_cmd.qc
qcsrc/common/command/generic.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/sv_cmd.qc

index 465eaaac062f9236847f5a3fef341b834c67f785..710e927a25f40a21e3b173fbaddcf58e3dd33e44 100644 (file)
@@ -298,7 +298,8 @@ void LocalCommand_(float request)
 //  Macro system for client commands
 // ==================================
 
-// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
+// Normally do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
+// but for 0.5 compat, we need vyes and vno here as they were replaced... REMOVE THEM AFTER 0.6 RELEASE!!!!
 #define CLIENT_COMMANDS(request,arguments) \
        CLIENT_COMMAND("blurtest", LocalCommand_blurtest(request), "Feature for testing blur postprocessing") \
        CLIENT_COMMAND("debugmodel", LocalCommand_debugmodel(request, arguments), "Spawn a debug model manually") \
@@ -307,12 +308,14 @@ void LocalCommand_(float request)
        CLIENT_COMMAND("localprint", LocalCommand_localprint(request, arguments), "Create your own centerprint sent to yourself") \
        CLIENT_COMMAND("mv_download", LocalCommand_mv_download(request, arguments), "Retrieve mapshot picture from the server") \
        CLIENT_COMMAND("sendcvar", LocalCommand_sendcvar(request, arguments), "Send a cvar to the server (like weaponpriority)") \
+       CLIENT_COMMAND("vyes", LocalCommand_handlevote(request, tokenize_console("handlevote yes")), "") \
+       CLIENT_COMMAND("vno", LocalCommand_handlevote(request, tokenize_console("handlevote no")), "") \
        /* nothing */
        
 void LocalCommand_macro_help()
 {
        #define CLIENT_COMMAND(name,function,description) \
-               { print("  ^2", name, "^7: ", description, "\n"); }
+               { if(strtolower(description) != string_null) { print("  ^2", name, "^7: ", description, "\n"); } }
                
        CLIENT_COMMANDS(0, 0)
        #undef CLIENT_COMMAND
index 8508ef354618342604b17c18aa3fbe067e9319bc..0d4d2f8c9309d8ddf2918bb98131abda16e50f63 100644 (file)
@@ -300,7 +300,7 @@ void GenericCommand_(float request)
 void GenericCommand_macro_help()
 {
        #define GENERIC_COMMAND(name,function,description) \
-               { print("  ^2", name, "^7: ", description, "\n"); }
+               { if(strtolower(description) != string_null) { print("  ^2", name, "^7: ", description, "\n"); } }
                
        GENERIC_COMMANDS(0, 0, "")
        #undef GENERIC_COMMAND
index 27cc226bf588e871248220487b357dc5d8ed51d6..449164e7445d178a8b5cde99c2f2fed8150bec94 100644 (file)
@@ -568,7 +568,7 @@ void ClientCommand_(float request)
 void ClientCommand_macro_help()
 {
        #define CLIENT_COMMAND(name,function,description) \
-               { print("  ^2", name, "^7: ", description, "\n"); }
+               { sprint(self, "  ^2", name, "^7: ", description, "\n"); }
                
        CLIENT_COMMANDS(0, 0, "")
        #undef CLIENT_COMMAND
@@ -652,13 +652,13 @@ void SV_ParseClientCommand(string command)
                        ClientCommand_macro_help();
                        
                        print("\nCommon networked commands:\n");
-                       CommonCommand_macro_help();
+                       CommonCommand_macro_help(self);
                        
                        sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
                        sprint(self, "For help about a specific command, type cmd help COMMAND\n");
                        return;
                } 
-               else if(CommonCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it
+               else if(CommonCommand_macro_usage(argc, self)) // Instead of trying to call a command, we're going to see detailed information about it
                {
                        return;
                }
@@ -675,7 +675,7 @@ void SV_ParseClientCommand(string command)
        {
                return; // handled by server/cheats.qc
        }
-       else if(CommonCommand_macro_command(argc, command))
+       else if(CommonCommand_macro_command(argc, self, command))
        {
                return; // handled by server/command/common.qc
        }
index 9247dffea74ee64e71f072bace05fa2ab77a68db..912e6e6ad6705d0bde8a15630422c1893c32f7a1 100644 (file)
@@ -667,52 +667,52 @@ void CommonCommand_(float request, entity caller)
 // ==================================
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-#define COMMON_COMMANDS(request,arguments,command) \
-       COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, world), "Prints a list of all changed server cvars") \
-       COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, world), "Prints a list of all changed gameplay cvars") \
-       COMMON_COMMAND("info", CommonCommand_info(request, world, arguments), "Request for unique server information set up by admin") \
-       COMMON_COMMAND("ladder", CommonCommand_ladder(request, world), "Get information about top players if supported") \
-       COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, world), "List maps which can be used with the current game mode") \
-       COMMON_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, world), "List maps which have no records or are seemingly unplayed yet") \
-       COMMON_COMMAND("maplist", CommonCommand_maplist(request, world), "Display full server maplist reply") \
-       COMMON_COMMAND("rankings", CommonCommand_rankings(request, world), "Print information about rankings") \
-       COMMON_COMMAND("records", CommonCommand_records(request, world), "List top 10 records for the current map") \
-       COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, world), "Show information about player and team scores") \
-       COMMON_COMMAND("time", CommonCommand_time(request, world), "Print different formats/readouts of time") \
-       COMMON_COMMAND("timein", CommonCommand_timein(request, world), "Resume the game from being paused with a timeout") \
-       COMMON_COMMAND("timeout", CommonCommand_timeout(request, world), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
-       COMMON_COMMAND("vote", VoteCommand(request, world, arguments, command), "Request an action to be voted upon by players") \
-       COMMON_COMMAND("who", CommonCommand_who(request, world, arguments), "Display detailed client information about all players") \
+#define COMMON_COMMANDS(request,caller,arguments,command) \
+       COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, caller), "Prints a list of all changed server cvars") \
+       COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, caller), "Prints a list of all changed gameplay cvars") \
+       COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \
+       COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \
+       COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \
+       COMMON_COMMAND("lsnewmaps", CommonCommand_lsnewmaps(request, caller), "List maps which have no records or are seemingly unplayed yet") \
+       COMMON_COMMAND("maplist", CommonCommand_maplist(request, caller), "Display full server maplist reply") \
+       COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \
+       COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \
+       COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \
+       COMMON_COMMAND("time", CommonCommand_time(request, caller), "Print different formats/readouts of time") \
+       COMMON_COMMAND("timein", CommonCommand_timein(request, caller), "Resume the game from being paused with a timeout") \
+       COMMON_COMMAND("timeout", CommonCommand_timeout(request, caller), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
+       COMMON_COMMAND("vote", VoteCommand(request, caller, arguments, command), "Request an action to be voted upon by players") \
+       COMMON_COMMAND("who", CommonCommand_who(request, caller, arguments), "Display detailed client information about all players") \
        /* nothing */
 
-void CommonCommand_macro_help()
+void CommonCommand_macro_help(entity caller)
 {
        #define COMMON_COMMAND(name,function,description) \
-               { print("  ^2", name, "^7: ", description, "\n"); }
+               { print_to(caller, strcat("  ^2", name, "^7: ", description, "\n")); }
                
-       COMMON_COMMANDS(0, 0, "")
+       COMMON_COMMANDS(0, caller, 0, "")
        #undef COMMON_COMMAND
        
        return;
 }
 
-float CommonCommand_macro_command(float argc, string command)
+float CommonCommand_macro_command(float argc, entity caller, string command)
 {
        #define COMMON_COMMAND(name,function,description) \
                { if(name == strtolower(argv(0))) { function; return TRUE; } }
                
-       COMMON_COMMANDS(CMD_REQUEST_COMMAND, argc, command)
+       COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command)
        #undef COMMON_COMMAND
        
        return FALSE;
 }
 
-float CommonCommand_macro_usage(float argc)
+float CommonCommand_macro_usage(float argc, entity caller)
 {
        #define COMMON_COMMAND(name,function,description) \
                { if(name == strtolower(argv(1))) { function; return TRUE; } }
                
-       COMMON_COMMANDS(CMD_REQUEST_USAGE, argc, "")
+       COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "")
        #undef COMMON_COMMAND
        
        return FALSE;
@@ -723,7 +723,7 @@ void CommonCommand_macro_write_aliases(float fh)
        #define COMMON_COMMAND(name,function,description) \
                { CMD_Write_Alias("qc_cmd_svcmd", name, description); }
                
-       COMMON_COMMANDS(0, 0, "")
+       COMMON_COMMANDS(0, world, 0, "")
        #undef COMMON_COMMAND
        
        return;
index 253d1c310af38e1f2801dec30662a955a80152e4..34075853d7c52454bcdb9a3534c4864c9cc74f09 100644 (file)
@@ -1749,7 +1749,7 @@ void GameCommand(string command)
                        GameCommand_Ban("help");
                        
                        print("\nCommon networked commands:\n");
-                       CommonCommand_macro_help();
+                       CommonCommand_macro_help(world);
                        
                        print("\nGeneric commands shared by all programs:\n");
                        GenericCommand_macro_help();
@@ -1759,7 +1759,7 @@ void GameCommand(string command)
                        
                        return;
                } 
-               else if(CommonCommand_macro_usage(argc)) // Instead of trying to call a command, we're going to see detailed information about it
+               else if(CommonCommand_macro_usage(argc, world)) // Instead of trying to call a command, we're going to see detailed information about it
                {
                        return;
                }
@@ -1776,7 +1776,7 @@ void GameCommand(string command)
        {
                return; // handled by server/command/ipban.qc
        }
-       else if(CommonCommand_macro_command(argc, command))
+       else if(CommonCommand_macro_command(argc, world, command))
        {
                return; // handled by server/command/common.qc
        }