summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-04-25 11:58:19 +0000
committerfrosch <frosch@openttd.org>2015-04-25 11:58:19 +0000
commit9fb56ca02e7e8122f57b73652c1b6734b3b45708 (patch)
tree0045b4d6cf342a109cf72ec4577824f43bcc862b /src/viewport.cpp
parent93d7db0b3608c7c081f8d291db6b8e93c942eb6e (diff)
downloadopenttd-9fb56ca02e7e8122f57b73652c1b6734b3b45708.tar.xz
(svn r27248) -Fix [FS#6257]: Town labels on smallmap and zoomed-out viewports were not centered. (_dp_)
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index ef23f1812..c1d4d61b4 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1309,8 +1309,9 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
* @param center the (preferred) center of the viewport sign
* @param top the new top of the sign
* @param str the string to show in the sign
+ * @param str_small the string to show when zoomed out. STR_NULL means same as \a str
*/
-void ViewportSign::UpdatePosition(int center, int top, StringID str)
+void ViewportSign::UpdatePosition(int center, int top, StringID str, StringID str_small)
{
if (this->width_normal != 0) this->MarkDirty();
@@ -1323,6 +1324,9 @@ void ViewportSign::UpdatePosition(int center, int top, StringID str)
this->center = center;
/* zoomed out version */
+ if (str_small != STR_NULL) {
+ GetString(buffer, str_small, lastof(buffer));
+ }
this->width_small = VPSM_LEFT + Align(GetStringBoundingBox(buffer, FS_SMALL).width, 2) + VPSM_RIGHT;
this->MarkDirty();