1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-22 03:42:41 +01:00

Add: Identify cities on the main viewport by appending an icon to their names (#14504)

Co-authored-by: Peter Nelson <peter1138@openttd.org>
This commit is contained in:
Su
2025-08-15 21:49:25 +01:00
committed by GitHub
parent 3d806d6a65
commit 85af200788
10 changed files with 36 additions and 6 deletions

View File

@@ -1359,12 +1359,21 @@ static void ViewportAddTownStrings(DrawPixelInfo *dpi, const std::vector<const T
ViewportStringFlags flags{};
if (small) flags.Set({ViewportStringFlag::Small, ViewportStringFlag::Shadow});
StringID stringid = !small && _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_TOWN_NAME;
StringID stringid_town = !small && _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_TOWN_NAME;
StringID stringid_town_city = stringid_town;
if (!small) {
stringid_town_city = _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_CITY_POP : STR_VIEWPORT_TOWN_CITY;
}
for (const Town *t : towns) {
std::string *str = ViewportAddString(dpi, &t->cache.sign, flags, INVALID_COLOUR);
if (str == nullptr) continue;
*str = GetString(stringid, t->index, t->cache.population);
if (t->larger_town) {
*str = GetString(stringid_town_city, t->index, t->cache.population);
} else {
*str = GetString(stringid_town, t->index, t->cache.population);
}
}
}