]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
moveplayer: add # to player number
authorterencehill <piuntn@gmail.com>
Sat, 30 Oct 2021 20:45:11 +0000 (22:45 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 30 Oct 2021 20:45:11 +0000 (22:45 +0200)
qcsrc/server/command/common.qc
qcsrc/server/command/common.qh
qcsrc/server/command/sv_cmd.qc

index 8d320437af013a7ce660d71efa63aaf563bd2e47..c2e039f753d952015d0c69f7b7b046ed762e1ad7 100644 (file)
@@ -168,17 +168,6 @@ entity GetFilteredEntity(string input)
        return selection;
 }
 
-// same thing, but instead return their edict number
-float GetFilteredNumber(string input)
-{
-       entity selection = GetFilteredEntity(input);
-       float output;
-
-       output = etof(selection);
-
-       return output;
-}
-
 // switch between sprint and print depending on whether the receiver is the server or a player
 void print_to(entity to, string input)
 {
index b16900a110536786f93606fc47f23fc9c6e71fd8..5fd66bdbbac1f595e76e0bb06ca4024d0865ea46 100644 (file)
@@ -95,9 +95,6 @@ entity GetIndexedEntity(int argc, float start_index);
 // find a player which matches the input string, and return their entity
 entity GetFilteredEntity(string input);
 
-// same thing, but instead return their edict number
-float GetFilteredNumber(string input);
-
 // switch between sprint and print depending on whether the receiver is the server or a player
 void print_to(entity to, string input);
 
index 4ed6e83ee3693b8f9cb7c302274fb7ac6adf9f77..c2b25faac3e3bf19bf43adb6bee6efa2109199fd 100644 (file)
@@ -998,6 +998,7 @@ void GameCommand_moveplayer(int request, int argc)
                                        // Check to see if the player is a valid target
                                        client = GetFilteredEntity(t);
                                        accepted = VerifyClientEntity(client, false, false);
+                                       string client_num_str = ftos(etof(client));
 
                                        if (accepted <= 0)
                                        {
@@ -1014,7 +1015,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                }
                                                else
                                                {
-                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is already spectating.");
+                                                       LOG_INFO("Player #", client_num_str, " (", pl_name, ") is already spectating.");
                                                }
                                        }
                                        else
@@ -1029,7 +1030,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                if (IS_SPEC(client) || IS_OBSERVER(client))
                                                {
                                                        // well technically we could, but should we allow that? :P
-                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is not in the game.");
+                                                       LOG_INFO("Player #", client_num_str, " (", pl_name, ") is not in the game.");
                                                        continue;
                                                }
 
@@ -1043,7 +1044,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                if (team_num == client.team)  // already on the destination team
                                                {
                                                        // keep the forcing undone
-                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is already on the ", Team_ColoredFullName(team_num), "^7.");
+                                                       LOG_INFO("Player #", client_num_str, " (", pl_name, ") is already on the ", Team_ColoredFullName(team_num), "^7.");
                                                        continue;
                                                }
                                                else if (team_num == 0)  // auto team
@@ -1073,7 +1074,7 @@ void GameCommand_moveplayer(int request, int argc)
                                                }
                                                if (!TeamBalance_IsTeamAllowed(balance, team_id))
                                                {
-                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") is not allowed to join the ", Team_ColoredFullName(team_num), "^7.");
+                                                       LOG_INFO("Player #", client_num_str, " (", pl_name, ") is not allowed to join the ", Team_ColoredFullName(team_num), "^7.");
                                                        TeamBalance_Destroy(balance);
                                                        continue;
                                                }
@@ -1084,11 +1085,11 @@ void GameCommand_moveplayer(int request, int argc)
                                                if (MoveToTeam(client, team_id, 6))
                                                {
                                                        successful = strcat(successful, (successful ? ", " : ""), pl_name);
-                                                       LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", pl_name, ") has been moved to the ", Team_ColoredFullName(team_num), "^7.");
+                                                       LOG_INFO("Player #", client_num_str, " (", pl_name, ") has been moved to the ", Team_ColoredFullName(team_num), "^7.");
                                                }
                                                else
                                                {
-                                                       LOG_INFO("Unable to move player ", ftos(GetFilteredNumber(t)), " (", pl_name, ")");
+                                                       LOG_INFO("Unable to move player #", client_num_str, " (", pl_name, ")");
                                                }
                                        }
                                } // loop end