diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 18ca24ce5b..debd1b93e9 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -377,7 +377,8 @@ void Town::UpdateVirtCoord() SetDParam(0, this->index); SetDParam(1, this->cache.population); this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_LVL_BASE, - _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN); + _settings_client.gui.population_in_label ? STR_VIEWPORT_TOWN_POP : STR_VIEWPORT_TOWN, + STR_VIEWPORT_TOWN); SetWindowDirty(WC_TOWN_VIEW, this->index); } diff --git a/src/viewport.cpp b/src/viewport.cpp index 8257fafb6e..0a0b033b62 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1310,7 +1310,7 @@ static void ViewportAddSigns(DrawPixelInfo *dpi) * @param top the new top of the sign * @param str the string to show in the sign */ -void ViewportSign::UpdatePosition(int center, int top, StringID str) +void ViewportSign::UpdatePosition(int center, int top, StringID str, StringID small_str) { if (this->width_normal != 0) this->MarkDirty(); @@ -1323,6 +1323,9 @@ void ViewportSign::UpdatePosition(int center, int top, StringID str) this->center = center; /* zoomed out version */ + if (small_str != STR_NULL) { + GetString(buffer, small_str, lastof(buffer)); + } this->width_small = VPSM_LEFT + Align(GetStringBoundingBox(buffer, FS_SMALL).width, 2) + VPSM_RIGHT; this->MarkDirty(); diff --git a/src/viewport_type.h b/src/viewport_type.h index 8c42802928..688875f7fd 100644 --- a/src/viewport_type.h +++ b/src/viewport_type.h @@ -14,6 +14,7 @@ #include "zoom_type.h" #include "strings_type.h" +#include "table/strings.h" class LinkGraphOverlay; @@ -50,7 +51,7 @@ struct ViewportSign { uint16 width_normal; ///< The width when not zoomed out (normal font) uint16 width_small; ///< The width when zoomed out (small font) - void UpdatePosition(int center, int top, StringID str); + void UpdatePosition(int center, int top, StringID str, StringID small_str=STR_NULL); void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const; };