From: Mario Date: Wed, 15 Feb 2017 10:52:10 +0000 (+1000) Subject: Use playername in a few more places X-Git-Tag: xonotic-v0.8.2~207 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=84c73d80872eb550a77fdcb255e762474a3456e6;p=xonotic%2Fxonotic-data.pk3dir.git Use playername in a few more places --- diff --git a/qcsrc/common/playerstats.qc b/qcsrc/common/playerstats.qc index 2a15b36d1..7f31e20d3 100644 --- a/qcsrc/common/playerstats.qc +++ b/qcsrc/common/playerstats.qc @@ -133,7 +133,7 @@ void PlayerStats_GameReport_FinalizePlayer(entity p) db_put(PS_GR_OUT_DB, sprintf("%s:_playerid", p.playerstats_id), ftos(p.playerid)); if(p.cvar_cl_allow_uid2name == 1 || IS_BOT_CLIENT(p)) - db_put(PS_GR_OUT_DB, sprintf("%s:_netname", p.playerstats_id), p.netname); + db_put(PS_GR_OUT_DB, sprintf("%s:_netname", p.playerstats_id), playername(p, false)); if(teamplay) db_put(PS_GR_OUT_DB, sprintf("%s:_team", p.playerstats_id), ftos(p.team)); diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index dd1e395c7..d54feeac8 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -77,13 +77,13 @@ float CheatsAllowed(entity this, float i, float argc, float fr) // the cheat get // if we get here, player is not allowed to cheat. Log it. if(i) - bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", this.netname, i); + bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", playername(this, false), i); else if(argc) - bprintf("Player %s^7 tried to use cheat '%s'\n", this.netname, argv(0)); + bprintf("Player %s^7 tried to use cheat '%s'\n", playername(this, false), argv(0)); else if(fr) - bprintf("Player %s^7 tried to use cheat frame %d\n", this.netname, fr); + bprintf("Player %s^7 tried to use cheat frame %d\n", playername(this, false), fr); else - bprintf("Player %s^7 tried to use an unknown cheat\n", this.netname); + bprintf("Player %s^7 tried to use an unknown cheat\n", playername(this, false)); return 0; } diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 91030beac..da9fd8621 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -242,12 +242,12 @@ void ClientCommand_ready(entity caller, float request) // todo: anti-spam for t if (caller.ready) // toggle { caller.ready = false; - bprint(caller.netname, "^2 is ^1NOT^2 ready\n"); + bprint(playername(caller, false), "^2 is ^1NOT^2 ready\n"); } else { caller.ready = true; - bprint(caller.netname, "^2 is ready\n"); + bprint(playername(caller, false), "^2 is ready\n"); } // cannot reset the game while a timeout is active! diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 8c9d915a2..81dc77725 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -138,8 +138,8 @@ void GameCommand_adminmsg(float request, float argc) sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", admin_message, "\n")); } - successful = strcat(successful, (successful ? ", " : ""), client.netname); - LOG_TRACE("Message sent to ", client.netname); + successful = strcat(successful, (successful ? ", " : ""), playername(client, false)); + LOG_TRACE("Message sent to ", playername(client, false)); continue; } @@ -542,7 +542,7 @@ void GameCommand_defer_clear(float request, float argc) if (accepted > 0) { stuffcmd(client, "defer clear\n"); - LOG_INFO("defer clear stuffed to ", client.netname, "\n"); + LOG_INFO("defer clear stuffed to ", playername(client, false), "\n"); } else { LOG_INFO("defer_clear: ", GetClientErrorString(accepted, argv(1)), ".\n"); } @@ -1047,11 +1047,11 @@ void GameCommand_moveplayer(float request, float argc) if (client.caplayer) client.caplayer = 0; PutObserverInServer(client); - successful = strcat(successful, (successful ? ", " : ""), client.netname); + successful = strcat(successful, (successful ? ", " : ""), playername(client, false)); } else { - LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already spectating.\n"); + LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already spectating.\n"); } continue; } @@ -1071,7 +1071,7 @@ void GameCommand_moveplayer(float request, float argc) if (team_id == client.team) // already on the destination team { // keep the forcing undone - LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n")); + LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n")); continue; } else if (team_id == 0) // auto team @@ -1100,8 +1100,8 @@ void GameCommand_moveplayer(float request, float argc) // If so, lets continue and finally move the player client.team_forced = 0; MoveToTeam(client, team_id, 6); - successful = strcat(successful, (successful ? ", " : ""), client.netname); - LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n"); + successful = strcat(successful, (successful ? ", " : ""), playername(client, false)); + LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n"); continue; } else diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index e6e9f481f..067ed02e9 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -743,10 +743,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc privatemsgprefixlen = strlen(msgstr); msgstr = strcat(msgstr, msgin); cmsgstr = strcat(colorstr, colorprefix, namestr, "^3 tells you:\n^7", msgin); - if(autocvar_g_chat_teamcolors) - privatemsgprefix = strcat("\{1}\{13}* ^3You tell ", playername(privatesay, true), ": ^7"); - else - privatemsgprefix = strcat("\{1}\{13}* ^3You tell ", privatesay.netname, ": ^7"); + privatemsgprefix = strcat("\{1}\{13}* ^3You tell ", playername(privatesay, autocvar_g_chat_teamcolors), ": ^7"); } else if(teamsay) { diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index b46663043..eace0ee59 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -824,7 +824,7 @@ void Score_NicePrint_Player(entity to, entity p, float w) sk = p.scorekeeper; - s = strcat(s, p.netname); + s = strcat(s, playername(p, false)); for (;;) { i = strlennocol(s) - NAMEWIDTH; @@ -856,7 +856,7 @@ void Score_NicePrint_Spectators(entity to) void Score_NicePrint_Spectator(entity to, entity p) { - print_to(to, strcat(" ", p.netname)); + print_to(to, strcat(" ", playername(p, false))); } .float score_dummyfield; diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index d16bb781b..702376821 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -209,7 +209,7 @@ void SetPlayerTeam(entity pl, float t, float s, float noprint) LogTeamchange(pl.playerid, pl.team, 3); // log manual team join if(!noprint) - bprint(pl.netname, "^7 has changed from ", Team_NumberToColoredFullName(s), "^7 to ", Team_NumberToColoredFullName(t), "\n"); + bprint(playername(pl, false), "^7 has changed from ", Team_NumberToColoredFullName(s), "^7 to ", Team_NumberToColoredFullName(t), "\n"); } } diff --git a/qcsrc/server/weapons/hitplot.qc b/qcsrc/server/weapons/hitplot.qc index 2a4ca8dc3..2a0fad7de 100644 --- a/qcsrc/server/weapons/hitplot.qc +++ b/qcsrc/server/weapons/hitplot.qc @@ -85,7 +85,7 @@ void W_HitPlotOpen(entity player) if(autocvar_g_hitplots || strhasword(autocvar_g_hitplots_individuals, player.netaddress)) { player.hitplotfh = fopen(strcat("hits-", matchid, "-", player.netaddress, "-", ftos(player.playerid), ".plot"), FILE_WRITE); - fputs(player.hitplotfh, strcat("#name ", player.netname, "\n")); + fputs(player.hitplotfh, strcat("#name ", playername(player, false), "\n")); } else { player.hitplotfh = -1; } }