]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/gamecommand.qc
Fix merge conflict
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / gamecommand.qc
index 03e863e278a1cfa8885469cfad5d30cd27bdb1f6..ea2e4034eb08fadb820ea319ae2e6fa17fca8401 100644 (file)
@@ -44,13 +44,18 @@ void Curl_URI_Get_Callback(float id, float status, string data)
        do_cvar = curl_uri_get_cvar[i];
        if(status != 0)
        {
-               print("error: status is ", ftos(status), "\n");
+               print(sprintf(_("error: status is %d\n"), status));
+               if(do_cvar)
+                       strunzone(do_cvar);
                return;
        }
        if(do_exec)
                localcmd(data);
        if(do_cvar)
+       {
                cvar_set(do_cvar, data);
+               strunzone(do_cvar);
+       }
        if(!do_exec && !do_cvar)
                print(data);
 }
@@ -62,9 +67,9 @@ void GameCommand(string theCommand)
 
        if(argv(0) == "help" || argc == 0)
        {
-               print("Usage: menu_cmd theCommand..., where possible theCommands are:\n");
-               print("  sync - reloads all cvars on the current menu page\n");
-               print("  directmenu ITEM - select a menu item as main item\n");
+               print(_("Usage: menu_cmd command..., where possible commands are:\n"));
+               print(_("  sync - reloads all cvars on the current menu page\n"));
+               print(_("  directmenu ITEM - select a menu item as main item\n"));
                GameCommand_Generic("help");
                return;
        }
@@ -74,7 +79,7 @@ void GameCommand(string theCommand)
 
        if(argv(0) == "sync")
        {
-               loadAllCvars(main);
+               m_sync();
                return;
        }
 
@@ -99,6 +104,12 @@ void GameCommand(string theCommand)
                return;
        }
 
+       if(argv(0) == "languageselect")
+       {
+               m_goto_language_selector();
+               return;
+       }
+
        if(argv(0) == "videosettings")
        {
                m_goto_video_settings();
@@ -112,18 +123,6 @@ void GameCommand(string theCommand)
                return;
        }
 
-       if(argv(0) == "setresolution")
-       {
-               updateConwidths();
-               return;
-       }
-
-       if(argv(0) == "setcompression")
-       {
-               updateCompression();
-               return;
-       }
-
        if(argv(0) == "curl")
        {
                float do_exec;
@@ -132,6 +131,7 @@ void GameCommand(string theCommand)
                float i, j;
                string url;
                float buf;
+               float r;
 
                do_exec = FALSE;
                do_cvar = string_null;
@@ -142,21 +142,18 @@ void GameCommand(string theCommand)
                        if(argv(i) == "--cvar" && i+2 < argc)
                        {
                                ++i;
-                               do_cvar = argv(i);
-                               ++i;
+                               do_cvar = strzone(argv(i));
                                continue;
                        }
                        if(argv(i) == "--exec")
                        {
                                do_exec = TRUE;
-                               ++i;
                                continue;
                        }
                        if(argv(i) == "--key" && i+2 < argc)
                        {
                                ++i;
                                key = stof(argv(i));
-                               ++i;
                                continue;
                        }
                        break;
@@ -174,55 +171,23 @@ void GameCommand(string theCommand)
                        bufstr_set(buf, ++j, sprintf("submit=%s", uri_escape(argv(i))));
 
                if(j == 0) // no args: GET
-                       crypto_uri_postbuf(url, URI_GET_CURL + curl_uri_get_pos, string_null, string_null, -1, key);
+                       r = crypto_uri_postbuf(url, URI_GET_CURL + curl_uri_get_pos, string_null, string_null, -1, key);
                else // with args: POST
-                       crypto_uri_postbuf(url, URI_GET_CURL + curl_uri_get_pos, "application/x-www-form-urlencoded", "&", buf, key);
-
-               curl_uri_get_pos = mod(curl_uri_get_pos + 1, URI_GET_CURL_END - URI_GET_CURL + 1);
-
-               buf_del(buf);
-
-               return;
-       }
+                       r = crypto_uri_postbuf(url, URI_GET_CURL + curl_uri_get_pos, "application/x-www-form-urlencoded", "&", buf, key);
 
-#if 0
-       if(argv(0) == "tokentest")
-       {
-               string s;
-               float i, n;
-
-               print("SANE tokenizer:\n");
-               s = cvar_string("tokentest");
-               n = tokenize_console_force_builtin(s);
-               for(i = -n; i < n; ++i)
+               if(r)
                {
-                       print("token ", ftos(i), ": '", argv(i), "' = ");
-                       print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
+                       curl_uri_get_exec[curl_uri_get_pos] = do_exec;
+                       curl_uri_get_cvar[curl_uri_get_pos] = do_cvar;
+                       curl_uri_get_pos = mod(curl_uri_get_pos + 1, URI_GET_CURL_END - URI_GET_CURL + 1);
                }
-               print(".\n");
+               else
+                       print(_("error creating curl handle\n"));
 
-               print("INSANE tokenizer:\n");
-               s = cvar_string("tokentest");
-               n = tokenize(s);
-               for(i = -n; i < n; ++i)
-               {
-                       print("token ", ftos(i), ": '", argv(i), "' = ");
-                       print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
-               }
-               print(".\n");
+               buf_del(buf);
 
-               print("EMULATED tokenizer:\n");
-               s = cvar_string("tokentest");
-               n = tokenize_console_force_emulation(s);
-               for(i = -n; i < n; ++i)
-               {
-                       print("token ", ftos(i), ": '", argv(i), "' = ");
-                       print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n");
-               }
-               print(".\n");
                return;
        }
-#endif
 
-       print("Invalid theCommand. For a list of supported theCommands, try menu_cmd help.\n");
+       print(_("Invalid command. For a list of supported commands, try menu_cmd help.\n"));
 }