summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/airport_gui.cpp7
-rw-r--r--src/dock_gui.cpp8
-rw-r--r--src/misc_gui.cpp10
-rw-r--r--src/rail_gui.cpp7
-rw-r--r--src/road_gui.cpp9
-rw-r--r--src/station_gui.h2
6 files changed, 33 insertions, 10 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index c65951bc9..86f288610 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -186,7 +186,12 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
DrawWindowWidgets(w);
// strings such as 'Size' and 'Coverage Area'
// 'Coverage Area'
- DrawStationCoverageAreaText(2, 206, SCT_ALL, rad);
+ int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad) + 4;
+ if (text_end > w->widget[6].bottom) {
+ SetWindowDirty(w);
+ ResizeWindowForWidget(w, 6, 0, text_end - w->widget[6].bottom);
+ SetWindowDirty(w);
+ }
break;
}
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 2c36a1616..39f40a3a2 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -254,7 +254,13 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
SetTileSelectSize(1, 1);
}
- DrawStationCoverageAreaText(4, 50, SCT_ALL, rad);
+ int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad) + 4;
+ if (text_end > w->widget[2].bottom) {
+ SetWindowDirty(w);
+ ResizeWindowForWidget(w, 2, 0, text_end - w->widget[2].bottom);
+ SetWindowDirty(w);
+ }
+
break;
}
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 8ef6d5f3f..aa4a96902 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -773,7 +773,7 @@ void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[
}
-static void DrawStationCoverageText(const AcceptedCargo accepts,
+static int DrawStationCoverageText(const AcceptedCargo accepts,
int str_x, int str_y, StationCoverageType sct)
{
char *b = _userstring;
@@ -809,17 +809,19 @@ static void DrawStationCoverageText(const AcceptedCargo accepts,
/* Make sure we detect any buffer overflow */
assert(b < endof(_userstring));
- DrawStringMultiLine(str_x, str_y, STR_SPEC_USERSTRING, 144);
+ return DrawStringMultiLine(str_x, str_y, STR_SPEC_USERSTRING, 144);
}
-void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad)
+int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad)
{
TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
AcceptedCargo accepts;
if (tile < MapSize()) {
GetAcceptanceAroundTiles(accepts, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad);
- DrawStationCoverageText(accepts, sx, sy, sct);
+ return sy + DrawStationCoverageText(accepts, sx, sy, sct);
}
+
+ return sy;
}
void CheckRedrawStationCoverage(const Window *w)
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index b29267af3..698ceaa0c 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -864,7 +864,12 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING);
DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, TC_FROMSTRING);
- DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad);
+ int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad) + 4;
+ if (text_end > w->widget[BRSW_BACKGROUND].bottom) {
+ SetWindowDirty(w);
+ ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
+ SetWindowDirty(w);
+ }
if (newstations) {
uint y = 35;
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 11ccd44ef..811a20d82 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -825,9 +825,14 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
StationPickerDrawSprite(171, 35, st, INVALID_RAILTYPE, _cur_roadtype, 4);
StationPickerDrawSprite(171, 85, st, INVALID_RAILTYPE, _cur_roadtype, 5);
- DrawStationCoverageAreaText(2, 146,
+ int text_end = DrawStationCoverageAreaText(2, 146,
(w->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY,
- 3);
+ 3) + 4;
+ if (text_end > w->widget[BRSW_BACKGROUND].bottom) {
+ SetWindowDirty(w);
+ ResizeWindowForWidget(w, BRSW_BACKGROUND, 0, text_end - w->widget[BRSW_BACKGROUND].bottom);
+ SetWindowDirty(w);
+ }
} break;
diff --git a/src/station_gui.h b/src/station_gui.h
index ef4a3efeb..ad1db88db 100644
--- a/src/station_gui.h
+++ b/src/station_gui.h
@@ -58,7 +58,7 @@ enum StationCoverageType {
SCT_ALL
};
-void DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
+int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad);
void CheckRedrawStationCoverage(const Window *w);
extern bool _station_show_coverage;