mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r11993) -Fix: Resize station/roadstop/dock/airport construction windows if cargo acceptance list is too long.
This commit is contained in:
parent
7b29dcde3c
commit
0847def759
|
@ -186,7 +186,12 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
// strings such as 'Size' and 'Coverage Area'
|
// strings such as 'Size' and 'Coverage Area'
|
||||||
// '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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,13 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
||||||
SetTileSelectSize(1, 1);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
int str_x, int str_y, StationCoverageType sct)
|
||||||
{
|
{
|
||||||
char *b = _userstring;
|
char *b = _userstring;
|
||||||
|
@ -809,17 +809,19 @@ static void DrawStationCoverageText(const AcceptedCargo accepts,
|
||||||
/* Make sure we detect any buffer overflow */
|
/* Make sure we detect any buffer overflow */
|
||||||
assert(b < endof(_userstring));
|
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);
|
TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
|
||||||
AcceptedCargo accepts;
|
AcceptedCargo accepts;
|
||||||
if (tile < MapSize()) {
|
if (tile < MapSize()) {
|
||||||
GetAcceptanceAroundTiles(accepts, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad);
|
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)
|
void CheckRedrawStationCoverage(const Window *w)
|
||||||
|
|
|
@ -864,7 +864,12 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
|
||||||
DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING);
|
DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING);
|
||||||
DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, 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) {
|
if (newstations) {
|
||||||
uint y = 35;
|
uint y = 35;
|
||||||
|
|
|
@ -825,9 +825,14 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
|
||||||
StationPickerDrawSprite(171, 35, st, INVALID_RAILTYPE, _cur_roadtype, 4);
|
StationPickerDrawSprite(171, 35, st, INVALID_RAILTYPE, _cur_roadtype, 4);
|
||||||
StationPickerDrawSprite(171, 85, st, INVALID_RAILTYPE, _cur_roadtype, 5);
|
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,
|
(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;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ enum StationCoverageType {
|
||||||
SCT_ALL
|
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);
|
void CheckRedrawStationCoverage(const Window *w);
|
||||||
|
|
||||||
extern bool _station_show_coverage;
|
extern bool _station_show_coverage;
|
||||||
|
|
Loading…
Reference in New Issue