]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/cmd.qc
Merge branch 'master' into terencehill/quickmenu
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / cmd.qc
index 5a0527c899b4c3cf1d47ab4f2ffe939d980cf1ee..d38baf784a49ebac0ff823fb3f789edba57dda29 100644 (file)
@@ -16,7 +16,7 @@
 #include "../mutators/mutators_include.qh"
 
 #ifdef SVQC
-       #include "../vehicles/vehicle.qh"
+       #include "../../common/vehicles/all.qh"
 #endif
 
 #include "../../common/constants.qh"
 #include "../../common/teams.qh"
 #include "../../common/util.qh"
 
+#include "../../common/monsters/all.qc"
+#include "../../common/monsters/spawn.qh"
+#include "../../common/monsters/sv_monsters.qh"
+
 #include "../../warpzonelib/common.qh"
 
 void ClientKill_TeamChange (float targetteam); // 0 = don't change, -1 = auto, -2 = spec
@@ -89,7 +93,7 @@ void ClientCommand_checkfail(float request, string command) // internal command,
        {
                case CMD_REQUEST_COMMAND:
                {
-                       printf("CHECKFAIL: %s (%s) epically failed check %s\n", self.netname, self.netaddress, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+                       LOG_INFOF("CHECKFAIL: %s (%s) epically failed check %s\n", self.netname, self.netaddress, substring(command, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
                        self.checkfail = 1;
                        return; // never fall through to usage
                }
@@ -223,7 +227,7 @@ void ClientCommand_physics(float request, float argc)
                case CMD_REQUEST_COMMAND:
                {
                        string command = strtolower(argv(1));
-                       
+
                        if(!autocvar_g_physics_clientselect)
                        {
                                sprint(self, "Client physics selection is currently disabled.\n");
@@ -235,7 +239,7 @@ void ClientCommand_physics(float request, float argc)
                                sprint(self, strcat("Available physics sets: \n\n", autocvar_g_physics_clientselect_options, " default\n"));
                                return;
                        }
-                       
+
                        if(Physics_Valid(command) || command == "default")
                        {
                                stuffcmd(self, strcat("\nseta cl_physics ", command, "\nsendcvar cl_physics\n"));
@@ -243,7 +247,7 @@ void ClientCommand_physics(float request, float argc)
                                return;
                        }
                }
-       
+
                default:
                        sprint(self, strcat("Current physics set: ^3", self.cvar_cl_physics, "\n"));
                case CMD_REQUEST_USAGE:
@@ -556,7 +560,18 @@ void ClientCommand_tell(float request, float argc, string command)
                                {
                                        if(tell_to != self) // and we're allowed to send to them :D
                                        {
-                                               Say(self, false, tell_to, substring(command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token)), true);
+                                               // workaround for argv indexes indexing ascii chars instead of utf8 chars
+                                               // In this case when the player name contains utf8 chars
+                                               // the message gets partially trimmed in the beginning.
+                                               // Potentially this bug affects any substring call that uses
+                                               // argv_start_index and argv_end_index.
+
+                                               string utf8_enable_save = cvar_string("utf8_enable");
+                                               cvar_set("utf8_enable", "0");
+                                               string msg = substring(command, argv_start_index(next_token), argv_end_index(-1) - argv_start_index(next_token));
+                                               cvar_set("utf8_enable", utf8_enable_save);
+
+                                               Say(self, false, tell_to, msg, true);
                                                return;
                                        }
                                        else { print_to(self, "You can't ^2tell^7 a message to yourself."); return; }
@@ -656,6 +671,7 @@ void ClientCommand_(float request)
        CLIENT_COMMAND("suggestmap", ClientCommand_suggestmap(request, arguments), "Suggest a map to the mapvote at match end") \
        CLIENT_COMMAND("tell", ClientCommand_tell(request, arguments, command), "Send a message directly to a player") \
        CLIENT_COMMAND("voice", ClientCommand_voice(request, arguments, command), "Send voice message via sound") \
+       CLIENT_COMMAND("minigame", ClientCommand_minigame(request, arguments, command), "Start a minigame") \
        /* nothing */
 
 void ClientCommand_macro_help()
@@ -724,11 +740,6 @@ void SV_ParseClientCommand(string command)
 
        float argc = tokenize_console(command);
 
-       // for the mutator hook system
-       cmd_name = strtolower(argv(0));
-       cmd_argc = argc;
-       cmd_string = command;
-
        // Guide for working with argc arguments by example:
        // argc:   1    - 2      - 3     - 4
        // argv:   0    - 1      - 2     - 3
@@ -777,7 +788,7 @@ void SV_ParseClientCommand(string command)
                        return;
                }
        }
-       else if(MUTATOR_CALLHOOK(SV_ParseClientCommand))
+       else if(MUTATOR_CALLHOOK(SV_ParseClientCommand, strtolower(argv(0)), argc, command))
        {
                return; // handled by a mutator
        }