From b7dab14ccf9b2f6e86cee223fff699c069b0ed3f Mon Sep 17 00:00:00 2001
From: Louis Moureaux ");
+ // The rules
+ if (martial_law_max == 0) {
+ str += _("Every military unit in the city may impose martial law.");
} else {
- str += QString(PL_("%1 military unit may impose martial law.",
- "Up to %1 military units may impose martial "
- "law.",
- mlmax))
- .arg(QString::number(mlmax))
- + qendl();
+ str +=
+ QString(PL_("%1 military unit in the city may impose martial law.",
+ "Up to %1 military units in the city may impose "
+ "martial law.",
+ martial_law_max))
+ .arg(martial_law_max);
}
- str += QString(PL_("Each military unit makes %1 "
- "unhappy citizen content.",
- "Each military unit makes %1 "
- "unhappy citizens content.",
- mleach))
- .arg(QString::number(mleach))
- + qendl();
- } else if (uhcfac > 0) {
- str += QString(_("Military units in the field may cause unhappiness. "))
- + qendl();
+
+ str += QStringLiteral(" ");
+ str += QString(PL_("Each of them makes %1 unhappy citizen content.",
+ "Each of them makes %1 unhappy citizens content.",
+ martial_law_each))
+ .arg(martial_law_each);
+
+ str += QStringLiteral(" ");
+
+ int count = 0;
+ unit_list_iterate(pcity->tile->units, punit)
+ {
+ if ((count < martial_law_max || martial_law_max == 0)
+ && is_military_unit(punit)
+ && unit_owner(punit) == city_owner(pcity)) {
+ count++;
+ }
+ }
+ unit_list_iterate_end;
+
+ str +=
+ QString(PL_("%1 military unit in this city imposes the martial law.",
+ "%1 military units in this city impose the martial law.",
+ count))
+ .arg(count);
+ str += QStringLiteral(" ");
+ str += QString(PL_("%1 citizen is made happier as a result.",
+ "%1 citizens are made happier as a result.",
+ count * martial_law_each))
+ .arg(count * martial_law_each);
+
+ str += QStringLiteral(" ");
+
+ auto pplayer = city_owner(pcity);
+ int unhappy_factor = get_player_bonus(pplayer, EFT_UNHAPPY_FACTOR);
+ if (unhappy_factor == 0) {
+ str += _("Military units have no happiness effect.");
+ return str + QStringLiteral("
"); + if (count > 0) { + // TRANS: "This city supports %1 agressive military units, resulting in X + // unhappy citizens." (first part) + str += QString(PL_("This city supports %1 agressive military unit, ", + "This city supports %1 agressive military units, ", + count)) + .arg(count); + // TRANS: "This city supports %1 agressive military units, resulting in X + // unhappy citizens." (second part) + str += QString(PL_("resulting in %1 additional unhappy citizen.", + "resulting in %1 additional unhappy citizens.", + pcity->unit_happy_upkeep)) + .arg(pcity->unit_happy_upkeep); } else { - str += QString(_("Military units have no happiness effect. ")) + qendl(); + str += _("Currently, military units do not cause additional unhappiness " + "in this city."); } - return str.trimmed(); + + return str + QStringLiteral("
"); } /** diff --git a/client/text.h b/client/text.h index 01263d3422..a7e2b3591a 100644 --- a/client/text.h +++ b/client/text.h @@ -48,6 +48,6 @@ QString text_happiness_buildings(const struct city *pcity); QString text_happiness_nationality(const struct city *pcity); QString text_happiness_cities(const struct city *pcity); QString text_happiness_luxuries(const struct city *pcity); -const QString text_happiness_units(const struct city *pcity); +QString text_happiness_units(const struct city *pcity); QString text_happiness_wonders(const struct city *pcity); int get_bulbs_per_turn(int *pours, bool *pteam, int *ptheirs);