merging my updates, since they are already implemented in 1.5.1

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2015-05-10 22:31:52 +03:00
3 changed files with 8 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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;
};