From b9079a4e718a70d6a372f22f2ca7155633e88c7a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 7 May 2022 16:52:46 +0300 Subject: [PATCH 51/51] Do not regenerate team name in team_pretty_name() When using generated team names, and one has been generated already, use that existing name. Regenerating it resulted in a different name being returned from team_pretty_name() than what was otherwise been used, when team numbers had changed before the team_pretty_name() call. Reported by ddeanbrown See osdn #44382 Signed-off-by: Marko Lindqvist --- common/team.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/team.c b/common/team.c index 46e0c07d08..52a9df5f5f 100644 --- a/common/team.c +++ b/common/team.c @@ -436,7 +436,11 @@ int team_pretty_name(const struct team *pteam, char *buf, size_t buf_len) return fc_snprintf(buf, buf_len, _("team %s"), team_slot_name_translation(pteam->slot)); } else { - return fc_snprintf(buf, buf_len, _("team %d"), team_number(pteam)); + /* The generated name already contains word "Team" so don't repeat it. + * Also note that number of teams may have changed since the name + * was originally generated, so the number in it can be + * something else than current team_number(). */ + return fc_snprintf(buf, buf_len, "%s", team_name_translation(pteam)); } } -- 2.35.1