From da6a39c7534436fff0d8efbe1ff5efda40cefa87 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 23 Dec 2022 18:26:27 +0200 Subject: [PATCH 46/46] Tell user's relation to other player in score tooltip List if the nation in question is the player themselves, their ally (relevant especially when alliedvictory enabled), or someone they are at war with. See osdn #45792 Signed-off-by: Marko Lindqvist --- client/text.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/client/text.c b/client/text.c index 78477e5dfb..aa6b0e1ec7 100644 --- a/client/text.c +++ b/client/text.c @@ -2086,13 +2086,32 @@ const char *production_help(const struct universal *uni, char *buf, const char *score_tooltip(const struct player *pplayer, int score) { static char buf[1024]; + char *relation; + + if (client.conn.playing != NULL) { + if (pplayer == client.conn.playing) { + relation = _(" (us)"); + } else if (pplayers_allied(pplayer, client.conn.playing)) { + relation = _(" (an ally)"); + } else if (player_diplstate_get(pplayer, client.conn.playing)->type == DS_WAR) { + /* Actual enemy; don't want to use pplayers_at_war() that considers also + * never met players enemies. */ + relation = _(" (an enemy)"); + } else { + relation = ""; + } + } else { + relation = ""; + } if (score >= 0) { /* TRANS: %s is a Nation */ - fc_snprintf(buf, sizeof(buf), _("%s: score %d"), nation_adjective_for_player(pplayer), + fc_snprintf(buf, sizeof(buf), _("%s%s: score %d"), + nation_adjective_for_player(pplayer), relation, score); } else { - fc_snprintf(buf, sizeof(buf), "%s", nation_adjective_for_player(pplayer)); + fc_snprintf(buf, sizeof(buf), "%s%s", + nation_adjective_for_player(pplayer), relation); } return buf; -- 2.35.1