From 10ee5c4f4fbeb74fdfe9d63b8be67a41464ad0cc Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 28 Apr 2021 15:16:05 +0300 Subject: [PATCH 31/31] 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 | 34 ++++++++++++++++++++++++---------- common/traderoutes.c | 5 +++++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/client/text.c b/client/text.c index 6f4285b8ee..085b9e0f22 100644 --- a/client/text.c +++ b/client/text.c @@ -1699,28 +1699,42 @@ const char *get_act_sel_action_custom_text(struct action *paction, actor_unit->carrying, 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_base_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_base_between_cities(actor_homecity, target_city)); + } else { + astr_set(&custom, + /* TRANS: Estimated recurring revenue for + * the Establish Trade _Route action. */ + _("%d trade"), + trade_base_between_cities(actor_homecity, target_city)); + } } else if (action_has_result(paction, ACTION_MARKETPLACE)) { int revenue = get_caravan_enter_city_trade_bonus(actor_homecity, target_city, actor_unit->carrying, 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 ((action_has_result(paction, ACTION_HELP_WONDER) || action_has_result(paction, ACTION_RECYCLE_UNIT)) && city_owner(target_city) == client.conn.playing) { /* Can only give remaining production for domestic and existing * cities. */ int cost = city_production_build_shield_cost(target_city); + astr_set(&custom, _("%d remaining"), cost - target_city->shield_stock); } else { /* No info to add. */ diff --git a/common/traderoutes.c b/common/traderoutes.c index f69625a4d3..5ad8bad0bc 100644 --- a/common/traderoutes.c +++ b/common/traderoutes.c @@ -457,6 +457,11 @@ int get_caravan_enter_city_trade_bonus(const struct city *pc1, const bool establish_trade) { int tb = 0, bonus = 0; + enum trade_route_type trtype = cities_trade_route_type(pc1, pc2); + + if (trtss[trtype].bonus_type == TBONUS_NONE) { + return 0; + } if (game.info.caravan_bonus_style == CBS_CLASSIC) { /* Should this be real_map_distance? */ -- 2.30.2