]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/command/sv_cmd.qc
Manual riddance of remaining "if not".
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / command / sv_cmd.qc
index b47197fe03ab07b5d731745c67aba131bd0ed89c..7dbafa7ab8b747d888e1e06868a3717938463d3a 100644 (file)
@@ -93,7 +93,7 @@ void GameCommand_adminmsg(float request, float argc)
                                        client = GetFilteredEntity(t);
                                        accepted = VerifyClientEntity(client, TRUE, FALSE);
                                        
-                                       if not(accepted > 0) 
+                                       if(accepted <= 0) 
                                        {
                                                print("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n")); 
                                                continue;
@@ -736,7 +736,12 @@ void GameCommand_gametype(float request, float argc)
                                        MapInfo_SwitchGameType(t);
                                        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
                                        if(MapInfo_count > 0)
+                                       {
+                                               // update lsmaps in case the gametype changed, this way people can easily list maps for it
+                                               if(lsmaps_reply != "") { strunzone(lsmaps_reply); }
+                                               lsmaps_reply = strzone(getlsmaps());
                                                bprint("Game type successfully switched to ", s, "\n");
+                                       }
                                        else
                                        {
                                                bprint("Cannot use this game type: no map for it found\n");
@@ -987,7 +992,7 @@ void GameCommand_moveplayer(float request, float argc)
                                        client = GetFilteredEntity(t);
                                        accepted = VerifyClientEntity(client, FALSE, FALSE);
                                        
-                                       if not(accepted > 0) 
+                                       if(accepted <= 0) 
                                        {
                                                print("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n")); 
                                                continue;
@@ -996,7 +1001,7 @@ void GameCommand_moveplayer(float request, float argc)
                                        // Where are we putting this player?
                                        if(destination == "spec" || destination == "spectator") 
                                        {
-                                               if(client.classname != "spectator" && client.classname != "observer")
+                                               if(!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
                                                        self = client;
                                                        PutObserverInServer();
@@ -1011,7 +1016,7 @@ void GameCommand_moveplayer(float request, float argc)
                                        }
                                        else
                                        {
-                                               if(client.classname != "spectator" && client.classname != "observer")
+                                               if(!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
                                                        if(teamplay)
                                                        {
@@ -1041,10 +1046,10 @@ void GameCommand_moveplayer(float request, float argc)
                                                                // Check to see if the destination team is even available
                                                                switch(team_id) 
                                                                {
-                                                                       case FL_TEAM_1: if(c1 == -1) { print("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
-                                                                       case FL_TEAM_2: if(c2 == -1) { print("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
-                                                                       case FL_TEAM_3: if(c3 == -1) { print("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
-                                                                       case FL_TEAM_4: if(c4 == -1) { print("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
+                                                                       case NUM_TEAM_1: if(c1 == -1) { print("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
+                                                                       case NUM_TEAM_2: if(c2 == -1) { print("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
+                                                                       case NUM_TEAM_3: if(c3 == -1) { print("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
+                                                                       case NUM_TEAM_4: if(c4 == -1) { print("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
                                                                        
                                                                        default: print("Sorry, can't move player here if team ", destination, " doesn't exist.\n"); return;
                                                                }
@@ -1105,7 +1110,7 @@ void GameCommand_nospectators(float request)
                        entity plr;
                        FOR_EACH_CLIENT(plr) //give every spectator <g_maxplayers_spectator_blocktime> seconds time to become a player
                        {
-                               if(plr.classname == "spectator" || plr.classname == "observer")
+                               if(IS_SPEC(plr) || IS_OBSERVER(plr))
                                {
                                        plr.spectatortime = time;
                                        Send_Notification(NOTIF_ONE_ONLY, plr, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
@@ -1143,7 +1148,7 @@ void GameCommand_playerdemo(float request, float argc)
                                                client = GetIndexedEntity(argc, 2);
                                                accepted = VerifyClientEntity(client, FALSE, TRUE);
                                                
-                                               if not(accepted > 0) 
+                                               if(accepted <= 0) 
                                                {
                                                        print("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".\n"); 
                                                        return;
@@ -1159,7 +1164,7 @@ void GameCommand_playerdemo(float request, float argc)
                                                client = GetIndexedEntity(argc, 2);
                                                accepted = VerifyClientEntity(client, FALSE, FALSE);
                                                
-                                               if not(accepted > 0) 
+                                               if(accepted <= 0) 
                                                {
                                                        print("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".\n"); 
                                                        return;
@@ -1355,9 +1360,9 @@ void GameCommand_shuffleteams(float request)
                                        // sort through the random list of players made earlier 
                                        for(z = 1; z <= maxclients; ++z)
                                        {                                                       
-                                               if not(shuffleteams_teams[i] >= x)
+                                               if (!(shuffleteams_teams[i] >= x))
                                                {
-                                                       if not(shuffleteams_players[z])
+                                                       if (!(shuffleteams_players[z]))
                                                                continue; // not a player, move on to next random slot
                                                                
                                                        if(VerifyClientNumber(shuffleteams_players[z]))
@@ -1588,10 +1593,10 @@ void GameCommand_trace(float request, float argc)
                                
                                case "walk":
                                {
-                                       if(argc == 3)
+                                       if(argc == 4)
                                        {
                                                e = nextent(world);
-                                               if(tracewalk(e, stov(argv(1)), e.mins, e.maxs, stov(argv(2)), MOVE_NORMAL))
+                                               if(tracewalk(e, stov(argv(2)), e.mins, e.maxs, stov(argv(3)), MOVE_NORMAL))
                                                        print("can walk\n");
                                                else
                                                        print("cannot walk\n");
@@ -1601,10 +1606,10 @@ void GameCommand_trace(float request, float argc)
                                
                                case "showline":
                                {
-                                       if(argc == 3)
+                                       if(argc == 4)
                                        {
-                                               vv = stov(argv(1));
-                                               dv = stov(argv(2));
+                                               vv = stov(argv(2));
+                                               dv = stov(argv(3));
                                                traceline(vv, dv, MOVE_NORMAL, world);
                                                trailparticles(world, particleeffectnum("TR_NEXUIZPLASMA"), vv, trace_endpos);
                                                trailparticles(world, particleeffectnum("TR_CRYLINKPLASMA"), trace_endpos, dv);
@@ -1721,7 +1726,6 @@ void GameCommand_(float request)
 // ==================================
 
 // Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-// Common commands have double indentation to separate them a bit.
 #define SERVER_COMMANDS(request,arguments,command) \
        SERVER_COMMAND("adminmsg", GameCommand_adminmsg(request, arguments), "Send an admin message to a client directly") \
        SERVER_COMMAND("allready", GameCommand_allready(request), "Restart the server and reset the players") \