]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/terencehill/cmd_fixes'
authorSamual Lenks <samual@xonotic.org>
Wed, 12 Dec 2012 21:52:52 +0000 (16:52 -0500)
committerSamual Lenks <samual@xonotic.org>
Wed, 12 Dec 2012 21:52:52 +0000 (16:52 -0500)
Conflicts:
qcsrc/client/scoreboard.qc
qcsrc/server/g_world.qc

_hud_common.cfg
qcsrc/client/command/cl_cmd.qc
qcsrc/client/scoreboard.qc
qcsrc/common/command/generic.qc
qcsrc/common/util.qc
qcsrc/menu/command/menu_cmd.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/g_world.qc

index f246ab7bc014a29188a3341232813a9e9631f7ae..5179bb2abfcddf226f547c457d0877e39d78f5b7 100644 (file)
@@ -28,9 +28,9 @@ seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_ch
 
 // hud panel aliases
 alias hud_panel_radar_rotate "toggle hud_panel_radar_rotation 0 1 2 3 4"
-alias +hud_panel_radar_maximized "cl_cmd hud_panel_radar_maximized 1"
-alias -hud_panel_radar_maximized "cl_cmd hud_panel_radar_maximized 0"
-alias hud_panel_radar_maximized "cl_cmd hud_panel_radar_maximized"
+alias +hud_panel_radar_maximized "cl_cmd hud radar 1"
+alias -hud_panel_radar_maximized "cl_cmd hud radar 0"
+alias hud_panel_radar_maximized "cl_cmd hud radar"
 
 // other hud cvars
 seta hud_showbinds 1   "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both"
index 23b9b8c70a5b7ee2486a7a7497f13f0751396237..acac8b3121574d22a2ec706a9f78849b5a404712 100644 (file)
@@ -214,7 +214,10 @@ void LocalCommand_hud(float request, float argc)
                                
                                case "radar":
                                {
-                                       hud_panel_radar_maximized = (argv(2) ? InterpretBoolean(argv(2)) : !hud_panel_radar_maximized);
+                                       if(argv(2))
+                                               hud_panel_radar_maximized = InterpretBoolean(argv(2));
+                                       else
+                                               hud_panel_radar_maximized = !hud_panel_radar_maximized;
                                        return;
                                }
                        }
index 364f9e969e27aeee9a5ca91c3a3310f2b4ee3740..83991f6f1cb49e9a66eb80170f9488282944a97c 100644 (file)
@@ -311,15 +311,15 @@ void Cmd_HUD_SetFields(float argc)
 
        // TODO: re enable with gametype dependant cvars?
        if(argc < 3) // no arguments provided
-               argc = tokenizebyseparator(strcat("x ", autocvar_scoreboard_columns), " ");
+               argc = tokenizebyseparator(strcat("0 1 ", autocvar_scoreboard_columns), " ");
 
        if(argc < 3)
-               argc = tokenizebyseparator(strcat("x ", HUD_DefaultColumnLayout()), " ");
+               argc = tokenizebyseparator(strcat("0 1 ", HUD_DefaultColumnLayout()), " ");
 
        if(argc == 3)
        {
                if(argv(2) == "default")
-                       argc = tokenizebyseparator(strcat("x ", HUD_DefaultColumnLayout()), " ");
+                       argc = tokenizebyseparator(strcat("0 1 ", HUD_DefaultColumnLayout()), " ");
                else if(argv(2) == "all")
                {
                        string s;
@@ -334,17 +334,17 @@ void Cmd_HUD_SetFields(float argc)
                        if(ps_secondary != ps_primary)
                                s = strcat(s, " ", scores_label[ps_secondary]);
                        s = strcat(s, " ", scores_label[ps_primary]);
-                       argc = tokenizebyseparator(strcat("x ", s), " ");
+                       argc = tokenizebyseparator(strcat("0 1 ", s), " ");
                }
        }
 
 
        hud_num_fields = 0;
 
-       hud_fontsize = HUD_GetFontsize("hud_fontsize"); 
+       hud_fontsize = HUD_GetFontsize("hud_fontsize");
 
        draw_beginBoldFont();
-       for(i = 0; i < argc - 1; ++i)
+       for(i = 1; i < argc - 1; ++i)
        {
                float nocomplain;
                str = argv(i+1);
index b7b8da0e9f407f64da0bab06bc3dae90c7d4c528..07998d09c67b774b2636b61b13198318fe231283 100644 (file)
@@ -84,7 +84,7 @@ void GenericCommand_addtolist(float request, float argc)
                        print("Incorrect parameters for ^2addtolist^7\n");
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " addtolist variable value"));
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " addtolist variable value\n"));
                        print("  Where 'variable' is what to add 'value' to.\n");
                        print("See also: ^2removefromlist^7\n");
                        return;
@@ -307,7 +307,7 @@ void GenericCommand_maplist(float request, float argc)
                        print("Incorrect parameters for ^2maplist^7\n");
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " maplist action [map]"));
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " maplist action [map]\n"));
                        print("  Where 'action' is the command to complete,\n");
                        print("  and 'map' is what it acts upon (if required).\n");
                        print("  Full list of commands here: \"add, cleanup, remove, shuffle.\"\n");
@@ -329,7 +329,7 @@ void GenericCommand_nextframe(float request, float arguments, string command)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " nextframe command..."));
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " nextframe command...\n"));
                        print("  Where command will be executed next frame of this VM\n");
                        return;
                }
@@ -367,7 +367,7 @@ void GenericCommand_removefromlist(float request, float argc)
                        print("Incorrect parameters for ^2removefromlist^7\n");
                case CMD_REQUEST_USAGE:
                {
-                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value"));
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value\n"));
                        print("  Where 'variable' is what cvar to remove 'value' from.\n");
                        print("See also: ^2addtolist^7\n");
                        return;
@@ -383,15 +383,17 @@ void GenericCommand_settemp(float request, float argc)
                {
                        if(argc >= 3)
                        {
-                               if(cvar_settemp(argv(1), argv(2)))
+                               float f = cvar_settemp(argv(1), argv(2));
+                               if(f == 1)
                                        dprint("Creating new settemp tracker for ", argv(1), " and setting it to \"", argv(2), "\" temporarily.\n"); 
-                               else
+                               else if(f == -1)
                                        dprint("Already had a tracker for ", argv(1), ", updating it to \"", argv(2), "\".\n");
-                       
+                               // else cvar_settemp itself errors out
+
                                return;
                        }
                }
-                       
+
                default:
                        print("Incorrect parameters for ^2settemp^7\n");
                case CMD_REQUEST_USAGE:
index 53c14cfb0cd1798a706bb96cb36bce8afd924ba8..afd7f1c5ce25ea2bad16b2d3dda0c58c30d4ddad 100644 (file)
@@ -865,31 +865,37 @@ float cvar_settemp(string tmp_cvar, string tmp_value)
        float created_saved_value;
        entity e;
 
-       created_saved_value = FALSE;
-       
+       created_saved_value = 0;
+
        if not(tmp_cvar || tmp_value)
        {
                dprint("Error: Invalid usage of cvar_settemp(string, string); !\n");
-               return FALSE;
+               return 0;
        }
-       
+
+       if(!cvar_type(tmp_cvar))
+       {
+               print(sprintf("Error: cvar %s doesn't exist!\n", tmp_cvar));
+               return 0;
+       }
+
        for(e = world; (e = find(e, classname, "saved_cvar_value")); )
                if(e.netname == tmp_cvar)
-                       goto saved; // skip creation
-                       
-       // creating a new entity to keep track of this cvar
-       e = spawn();
-       e.classname = "saved_cvar_value";
-       e.netname = strzone(tmp_cvar);
-       e.message = strzone(cvar_string(tmp_cvar));
-       created_saved_value = TRUE;
-       
-       // an entity for this cvar already exists
-       :saved
-       
+                       created_saved_value = -1; // skip creation
+
+       if(created_saved_value != -1)
+       {
+               // creating a new entity to keep track of this cvar
+               e = spawn();
+               e.classname = "saved_cvar_value";
+               e.netname = strzone(tmp_cvar);
+               e.message = strzone(cvar_string(tmp_cvar));
+               created_saved_value = 1;
+       }
+
        // update the cvar to the value given
        cvar_set(tmp_cvar, tmp_value);
-       
+
        return created_saved_value;
 }
 
@@ -897,12 +903,18 @@ float cvar_settemp_restore()
 {
        float i;
        entity e;
-       while((e = find(world, classname, "saved_cvar_value")))
+       while((e = find(e, classname, "saved_cvar_value")))
        {
-               cvar_set(e.netname, e.message);
-               remove(e);
+               if(cvar_type(e.netname))
+               {
+                       cvar_set(e.netname, e.message);
+                       remove(e);
+                       ++i;
+               }
+               else
+                       print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", e.netname));
        }
-       
+
        return i;
 }
 
index f6312931f6a11c4117c159433c2361c949ec22c0..9d99c5c8eaba2fa17c01a5b5928a2f34cb4ae1bc 100644 (file)
@@ -35,7 +35,10 @@ void GameCommand(string theCommand)
                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"));
-               GenericCommand("help");
+
+               print("\nGeneric commands shared by all programs:\n");
+               GenericCommand_macro_help();
+
                return;
        }
 
index 25c7940cb7bf6831dbdb2b4208c779ea6f0fe471..2dd52317569ab862e62a3a01ae56fe98c1b1761f 100644 (file)
@@ -1689,8 +1689,9 @@ void GameCommand_warp(float request, float argc)
                default:
                case CMD_REQUEST_USAGE:
                {
-                       print("\nUsage:^3 sv_cmd level\n");
+                       print("\nUsage:^3 sv_cmd warp [level]\n");
                        print("  'level' is the level to change campaign mode to.\n");
+                       print("  if 'level' is not provided it will change to the next level.\n");
                        return;
                }
        }
index 69bf57d51b4af98e37a6f79e55d45cdc4cffe841..a41389a4fd2803ceea69176fa6f9ed0f9964c449 100644 (file)
@@ -826,18 +826,18 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed);
        addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw);
        addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw);
-       
+
        // secrets
        addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total);
        addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found);
 
        // misc
        addstat(STAT_RESPAWN_TIME, AS_FLOAT, stat_respawn_time);
-       
+
        next_pingtime = time + 5;
 
        detect_maptype();
-       
+
        // set up information replies for clients and server to use
        lsmaps_reply = "^7Maps available: ";
        lsnewmaps_reply = "^7Maps without a record set: ";
@@ -850,18 +850,18 @@ void spawnfunc_worldspawn (void)
                                        col = "^2";
                                else
                                        col = "^3";
-                                       
+
                                ++j;
-                               
+
                                lsmaps_reply = strcat(lsmaps_reply, col, MapInfo_Map_bspname, " ");
-                               
+
                                if(g_race && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time"))))
                                        lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " ");
                                else if(g_cts && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "time"))))
                                        lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " ");
                        }
        }
-       
+
        lsmaps_reply = strzone(strcat(lsmaps_reply, "\n"));
        lsnewmaps_reply = strzone(strcat(((!g_race && !g_cts) ? "Need to be playing race or CTS for lsnewmaps to work." : lsnewmaps_reply), "\n"));
 
@@ -884,9 +884,11 @@ void spawnfunc_worldspawn (void)
 
        for(i = 0; i < 10; ++i)
        {
-               records_reply[i] = strzone(getrecords(i));
+               s = getrecords(i);
+               if (s)
+                       records_reply[i] = strzone(s);
        }
-       
+
        ladder_reply = strzone(getladder());
 
        rankings_reply = strzone(getrankings());
@@ -1345,10 +1347,10 @@ float mapvote_initialized;
 void IntermissionThink()
 {
        FixIntermissionClient(self);
-       
+
        float server_screenshot = (autocvar_sv_autoscreenshot && self.cvar_cl_autoscreenshot);
        float client_screenshot = (self.cvar_cl_autoscreenshot == 2);
-       
+
        if( (server_screenshot || client_screenshot)
                && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
        {