Codechange: Replace viewport StringID specialisation with flags. (#13237)

When drawing viewport strings, the StringID is used to determine how to draw the sign. Instead, allow the behaviour to be set by the caller with flags. This means that some of the viewport-specific strings are no longer necessary.

ViewportAddString() now returns a pointer to a string as it may not actually add the string, in which case preparing the string parameters in advance is a waste of time.
This commit is contained in:
2025-01-02 20:47:12 +00:00
committed by GitHub
parent fd7a883cbd
commit 810dc23215
8 changed files with 154 additions and 92 deletions

View File

@@ -415,8 +415,8 @@ void Town::UpdateVirtCoord()
SetDParam(0, this->index);
SetDParam(1, this->cache.population);
this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_BASE,
_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN,
STR_VIEWPORT_TOWN_TINY_WHITE);
_settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_TOWN_NAME,
STR_TOWN_NAME);
_viewport_sign_kdtree.Insert(ViewportSignKdtreeItem::MakeTown(this->index));