From 455f481c8df4c49726b3642835b6d496c8171dca Mon Sep 17 00:00:00 2001 From: pelya Date: Mon, 23 Mar 2020 00:27:59 +0200 Subject: [PATCH] Fixed minimap sizing --- src/smallmap_gui.cpp | 5 ++--- src/smallmap_gui.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 7ba687908a..cac02ae3f8 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -138,7 +138,6 @@ static LegendAndColour _legend_land_owners[NUM_NO_COMPANY_ENTRIES + MAX_COMPANIE }; #undef MK -#undef MKB #undef MC #undef MS #undef MO @@ -1729,7 +1728,7 @@ public: this->smallmap_window = dynamic_cast(w); assert(this->smallmap_window != nullptr); - this->smallest_x = max(display->smallest_x, bar->smallest_x + smallmap_window->GetMinLegendWidth()); + this->smallest_x = max(display->smallest_x, max(bar->smallest_x, smallmap_window->GetMinLegendWidth())); this->smallest_y = display->smallest_y + max(bar->smallest_y, smallmap_window->GetLegendHeight(smallmap_window->min_number_of_columns)); this->fill_x = max(display->fill_x, bar->fill_x); this->fill_y = (display->fill_y == 0 && bar->fill_y == 0) ? 0 : min(display->fill_y, bar->fill_y); @@ -1878,7 +1877,7 @@ void ShowSmallMap() { AllocateWindowDescFront(&_smallmap_desc, 0); SmallMapWindow *w = dynamic_cast(FindWindowByClass(WC_SMALLMAP)); - if (w && w->GetMinLegendWidth() > w->width) { + if (w && (int)w->GetMinLegendWidth() > w->width) { ResizeWindow(w, w->GetMinLegendWidth() - w->width, 0); } } diff --git a/src/smallmap_gui.h b/src/smallmap_gui.h index 363e65625d..c82de00ad0 100644 --- a/src/smallmap_gui.h +++ b/src/smallmap_gui.h @@ -175,7 +175,7 @@ public: * Compute minimal required width of the legends. * @return Minimally needed width for displaying the smallmap legends in pixels. */ - inline int GetMinLegendWidth() const + inline uint GetMinLegendWidth() const { return WD_FRAMERECT_LEFT + this->min_number_of_columns * this->column_width; }