From c90dc53bc0b9b25a563894de43600d3c3d588087 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 14 May 2021 21:14:46 +0300 Subject: [PATCH 04/20] Don't promise that there's a one time trade bonus when there is not Reported by chippo See osdn #42087 Signed-off-by: Marko Lindqvist --- client/text.c | 33 +++++++++++++++++++++++---------- common/traderoutes.c | 5 +++++ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/client/text.c b/client/text.c index 8278801fe1..4ac43ec6a3 100644 --- a/client/text.c +++ b/client/text.c @@ -1697,21 +1697,34 @@ const char *get_act_sel_action_custom_text(struct action *paction, target_city, TRUE); - astr_set(&custom, - /* TRANS: Estimated one time bonus and recurring revenue for - * the Establish Trade _Route action. */ - _("%d one time bonus + %d trade"), - revenue, - trade_between_cities(actor_homecity, target_city)); + if (revenue > 0) { + astr_set(&custom, + /* TRANS: Estimated one time bonus and recurring revenue for + * the Establish Trade _Route action. */ + _("%d one time bonus + %d trade"), + revenue, + trade_between_cities(actor_homecity, target_city)); + } else { + astr_set(&custom, + /* TRANS: Estimated one time bonus for + * the Establish Trade _Route action. */ + _("%d trade"), + trade_between_cities(actor_homecity, target_city)); + } } else if (paction->id == ACTION_MARKETPLACE) { int revenue = get_caravan_enter_city_trade_bonus(actor_homecity, target_city, FALSE); - astr_set(&custom, - /* TRANS: Estimated one time bonus for the Enter Marketplace - * action. */ - _("%d one time bonus"), revenue); + if (revenue > 0) { + astr_set(&custom, + /* TRANS: Estimated one time bonus for the Enter Marketplace + * action. */ + _("%d one time bonus"), revenue); + } else { + /* No info to add. */ + return NULL; + } } else if (paction->id == ACTION_HELP_WONDER && city_owner(target_city) == client.conn.playing) { /* Can only give remaining production for domestic and existing diff --git a/common/traderoutes.c b/common/traderoutes.c index 10c4cfe814..ab222011bf 100644 --- a/common/traderoutes.c +++ b/common/traderoutes.c @@ -373,6 +373,11 @@ int get_caravan_enter_city_trade_bonus(const struct city *pc1, const bool establish_trade) { int tb, bonus; + enum trade_route_type trtype = cities_trade_route_type(pc1, pc2); + + if (trtss[trtype].bonus_type == TBONUS_NONE) { + return 0; + } /* Should this be real_map_distance? */ tb = map_distance(pc1->tile, pc2->tile) + 10; -- 2.30.2