diff --git a/client/text.cpp b/client/text.cpp index 9c153bd025..245fd393e5 100644 --- a/client/text.cpp +++ b/client/text.cpp @@ -1318,24 +1318,73 @@ const QString act_sel_action_tool_tip(const struct action *paction, } /** - Describing buildings that affect happiness. + * Describe buildings that affect happiness (or rather, anything with a + * Make_Content effect). */ QString text_happiness_buildings(const struct city *pcity) { - struct effect_list *plist = effect_list_new(); - QString effects; - QString str; + if (const auto effects = get_effects(EFT_MAKE_CONTENT); + effect_list_size(effects) == 0) { + effect_list_destroy(effects); + return QString(); // Disabled in the ruleset. + } - get_city_bonus_effects(plist, pcity, nullptr, EFT_MAKE_CONTENT); - if (0 < effect_list_size(plist)) { - effects = get_effect_list_req_text(plist); - str = QString(_("Buildings: %1.")).arg(effects); - } else { - str = _("Buildings: None."); + auto str = QStringLiteral("
"); + str += _("Infrastructure can have an effect on citizen happiness."); + str += QStringLiteral(" "); + + int bonus = get_city_bonus(pcity, EFT_MAKE_CONTENT); + if (bonus <= 0) { + // TRANS: Comes after "Infrastructure can have an effect on citizen + // happiness" + str += _("This city doesn't receive any such bonus."); + return str + QStringLiteral("
"); } - effect_list_destroy(plist); - return str.trimmed(); + // TRANS: Comes after "Infrastructure can have an effect on citizen + // happiness" + str += + QString( + PL_("In this city, it can make up to %1 citizen content.", + "In this city, it can make up to %1 citizens content.", + bonus)) + .arg(bonus); + + // Add a list of active effects + auto effects = effect_list_new(); + get_city_bonus_effects(effects, pcity, nullptr, EFT_MAKE_CONTENT); + + str += QStringLiteral(""); + // TRANS: Precedes a list of active effects, pluralized on its length. + str += PL_( + "The following contribution is active:", + "The following contributions are active:", effect_list_size(effects)); + str += QStringLiteral("