From 6451a12f55c7c419b27713976404a57687beace4 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 22 Jan 2023 07:56:18 +0200 Subject: [PATCH 28/28] Correct notifications sent about surgical strike - Victim's message contained their own name as the attacker - City references were not always sent as links See osdn #46473 Signed-off-by: Marko Lindqvist --- server/unithand.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/server/unithand.c b/server/unithand.c index ec2afafebd..69b30573fe 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -4877,6 +4877,7 @@ static bool do_unit_strike_city_production(const struct player *act_player, { struct player *tgt_player; char prod[256]; + const char *clink; /* Sanity checks */ fc_assert_ret_val(act_player, FALSE); @@ -4917,20 +4918,20 @@ static bool do_unit_strike_city_production(const struct player *act_player, nullify_prechange_production(tgt_city); /* Let the players know. */ + clink = city_link(tgt_city); /* Be careful not to call city_link() + * again as long as we need clink */ notify_player(act_player, city_tile(tgt_city), E_UNIT_ACTION_ACTOR_SUCCESS, ftc_server, _("Your %s succeeded in destroying" " the production of %s in %s."), unit_link(act_unit), - prod, - city_name_get(tgt_city)); + prod, clink); notify_player(tgt_player, city_tile(tgt_city), E_UNIT_ACTION_TARGET_HOSTILE, ftc_server, _("The production of %s was destroyed in %s," " %s are suspected."), - prod, - city_link(tgt_city), - nation_plural_for_player(tgt_player)); + prod, clink, + nation_plural_for_player(act_player)); return TRUE; } @@ -4953,6 +4954,7 @@ static bool do_unit_strike_city_building(const struct player *act_player, { struct player *tgt_player; struct impr_type *tgt_bld = improvement_by_number(tgt_bld_id); + const char *clink; /* Sanity checks */ fc_assert_ret_val(act_player, FALSE); @@ -5010,18 +5012,20 @@ static bool do_unit_strike_city_building(const struct player *act_player, send_city_info(NULL, tgt_city); /* Let the players know. */ + clink = city_link(tgt_city); /* Be careful not to call city_link() + * again as long as we need clink */ notify_player(act_player, city_tile(tgt_city), E_UNIT_ACTION_ACTOR_SUCCESS, ftc_server, _("Your %s destroyed the %s in %s."), unit_link(act_unit), improvement_name_translation(tgt_bld), - city_link(tgt_city)); + clink); notify_player(tgt_player, city_tile(tgt_city), E_UNIT_ACTION_TARGET_HOSTILE, ftc_server, _("The %s destroyed the %s in %s."), - nation_plural_for_player(tgt_player), + nation_plural_for_player(act_player), improvement_name_translation(tgt_bld), - city_link(tgt_city)); + clink); return TRUE; } -- 2.39.0