1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 17:32:45 +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

@@ -398,10 +398,17 @@ void Town::UpdateVirtCoord()
if (this->cache.sign.kdtree_valid) _viewport_sign_kdtree.Remove(ViewportSignKdtreeItem::MakeTown(this->index));
std::string town_string = GetString(STR_TOWN_NAME, this->index);
std::string town_string;
if (this->larger_town) {
town_string = GetString(_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_CITY_POP : STR_VIEWPORT_TOWN_CITY, this->index, this->cache.population);
} else {
town_string = GetString(_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_TOWN_NAME, this->index, this->cache.population);
}
this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_BASE,
_settings_client.gui.population_in_label ? GetString(STR_VIEWPORT_TOWN_POP, this->index, this->cache.population) : town_string,
town_string);
town_string,
GetString(STR_TOWN_NAME, this->index, this->cache.population)
);
_viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeTown(this->index));