diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/airport_gui.cpp | 6 | ||||
-rw-r--r-- | src/dock_gui.cpp | 10 | ||||
-rw-r--r-- | src/misc_gui.cpp | 15 | ||||
-rw-r--r-- | src/rail_gui.cpp | 10 | ||||
-rw-r--r-- | src/road_gui.cpp | 15 | ||||
-rw-r--r-- | src/station_gui.h | 2 |
6 files changed, 31 insertions, 27 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 9ea7963e5..f2714dac7 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -233,13 +233,13 @@ public: if (_settings_game.economy.station_noise_level) { /* show the noise of the selected airport */ SetDParam(0, airport->noise_level); - DrawString(WD_FRAMERECT_LEFT, this->width - WD_FRAMERECT_RIGHT, top, STR_STATION_NOISE); + DrawString(this->widget[BAW_BOTTOMPANEL].left + WD_FRAMERECT_LEFT, this->widget[BAW_BOTTOMPANEL].right - WD_FRAMERECT_RIGHT, top, STR_STATION_NOISE); top += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL; } /* strings such as 'Size' and 'Coverage Area' */ - top = DrawStationCoverageAreaText(WD_FRAMERECT_LEFT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL; - top = DrawStationCoverageAreaText(WD_FRAMERECT_LEFT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; + top = DrawStationCoverageAreaText(this->widget[BAW_BOTTOMPANEL].left + WD_FRAMERECT_LEFT, this->widget[BAW_BOTTOMPANEL].right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL; + top = DrawStationCoverageAreaText(this->widget[BAW_BOTTOMPANEL].left + WD_FRAMERECT_LEFT, this->widget[BAW_BOTTOMPANEL].right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; if (top != this->widget[BAW_BOTTOMPANEL].bottom) { this->SetDirty(); ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, top - this->widget[BAW_BOTTOMPANEL].bottom); diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 46ce1db29..cad78f3df 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -402,11 +402,13 @@ public: SetTileSelectSize(1, 1); } - int text_end = DrawStationCoverageAreaText(4, 50, SCT_ALL, rad, false); - text_end = DrawStationCoverageAreaText(4, text_end + 4, SCT_ALL, rad, true) + 4; - if (text_end != this->widget[BDSW_BACKGROUND].bottom) { + /* strings such as 'Size' and 'Coverage Area' */ + int top = this->widget[BDSW_LT_OFF].bottom + WD_PAR_VSEP_NORMAL; + top = DrawStationCoverageAreaText(this->widget[BDSW_BACKGROUND].left + WD_FRAMERECT_LEFT, this->widget[BDSW_BACKGROUND].right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL; + top = DrawStationCoverageAreaText(this->widget[BDSW_BACKGROUND].left + WD_FRAMERECT_LEFT, this->widget[BDSW_BACKGROUND].right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; + if (top != this->widget[BDSW_BACKGROUND].bottom) { this->SetDirty(); - ResizeWindowForWidget(this, 2, 0, text_end - this->widget[BDSW_BACKGROUND].bottom); + ResizeWindowForWidget(this, BDSW_BACKGROUND, 0, top - this->widget[BDSW_BACKGROUND].bottom); this->SetDirty(); } } diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index bfdfd7818..459ef5f36 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -811,7 +811,7 @@ void GuiShowTooltips(StringID str, uint paramcount, const uint64 params[], bool static int DrawStationCoverageText(const CargoArray &cargos, - int str_x, int str_y, StationCoverageType sct, bool supplies) + int left, int right, int top, StationCoverageType sct, bool supplies) { bool first = true; @@ -847,19 +847,20 @@ static int DrawStationCoverageText(const CargoArray &cargos, assert(b < endof(string)); SetDParamStr(0, string); - return DrawStringMultiLine(str_x, str_x + 144, str_y, INT32_MAX, STR_JUST_RAW_STRING); + return DrawStringMultiLine(left, right, top, INT32_MAX, STR_JUST_RAW_STRING); } /** * Calculates and draws the accepted or supplied cargo around the selected tile(s) - * @param sx x position where the string is to be drawn - * @param sy y position where the string is to be drawn + * @param left x position where the string is to be drawn + * @param right the right most position to draw on + * @param top y position where the string is to be drawn * @param sct which type of cargo is to be displayed (passengers/non-passengers) * @param rad radius around selected tile(s) to be searched * @param supplies if supplied cargos should be drawn, else accepted cargos * @return Returns the y value below the string that was drawn */ -int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad, bool supplies) +int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies) { TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y); if (tile < MapSize()) { @@ -869,10 +870,10 @@ int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad } else { cargos = GetAcceptanceAroundTiles(tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE, rad); } - return DrawStationCoverageText(cargos, sx, sy, sct, supplies); + return DrawStationCoverageText(cargos, left, right, top, sct, supplies); } - return sy; + return top; } void CheckRedrawStationCoverage(const Window *w) diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index dbd5e2638..c31b57e97 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1063,11 +1063,13 @@ public: DrawString(this->widget[BRSW_PLATFORM_LEN_1].left, this->widget[BRSW_PLATFORM_LEN_7].right, 101 + y_offset, STR_STATION_BUILD_PLATFORM_LENGTH, TC_FROMSTRING, SA_CENTER); DrawString(this->widget[BRSW_PLATFORM_LEN_1].left, this->widget[BRSW_PLATFORM_LEN_7].right, 141 + y_offset, STR_STATION_BUILD_COVERAGE_AREA_TITLE, TC_FROMSTRING, SA_CENTER); - int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad, false); - text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4; - if (text_end != this->widget[BRSW_BACKGROUND].bottom) { + /* strings such as 'Size' and 'Coverage Area' */ + int top = 166 + y_offset; + top = DrawStationCoverageAreaText(this->widget[BRSW_BACKGROUND].left + WD_FRAMERECT_LEFT, this->widget[BRSW_BACKGROUND].right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL; + top = DrawStationCoverageAreaText(this->widget[BRSW_BACKGROUND].left + WD_FRAMERECT_LEFT, this->widget[BRSW_BACKGROUND].right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; + if (top != this->widget[BRSW_BACKGROUND].bottom) { this->SetDirty(); - ResizeWindowForWidget(this, BRSW_BACKGROUND, 0, text_end - this->widget[BRSW_BACKGROUND].bottom); + ResizeWindowForWidget(this, BRSW_BACKGROUND, 0, top - this->widget[BRSW_BACKGROUND].bottom); this->SetDirty(); } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 302da2086..cb7155f92 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -955,15 +955,14 @@ struct BuildRoadStationWindow : public PickerWindowBase { StationPickerDrawSprite(171, 35, st, INVALID_RAILTYPE, _cur_roadtype, 4); StationPickerDrawSprite(171, 85, st, INVALID_RAILTYPE, _cur_roadtype, 5); - int text_end = DrawStationCoverageAreaText(2, 147, - (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY, - rad, false); - text_end = DrawStationCoverageAreaText(2, text_end + 4, - (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY, - rad, true) + 4; - if (text_end > this->widget[BRSW_BACKGROUND].bottom) { + /* strings such as 'Size' and 'Coverage Area' */ + StationCoverageType sct = (this->window_class == WC_BUS_STATION) ? SCT_PASSENGERS_ONLY : SCT_NON_PASSENGERS_ONLY; + int top = 147; + top = DrawStationCoverageAreaText(this->widget[BRSW_BACKGROUND].left + WD_FRAMERECT_LEFT, this->widget[BRSW_BACKGROUND].right - WD_FRAMERECT_RIGHT, top, sct, rad, false) + WD_PAR_VSEP_NORMAL; + top = DrawStationCoverageAreaText(this->widget[BRSW_BACKGROUND].left + WD_FRAMERECT_LEFT, this->widget[BRSW_BACKGROUND].right - WD_FRAMERECT_RIGHT, top, sct, rad, true) + WD_PAR_VSEP_NORMAL; + if (top != this->widget[BRSW_BACKGROUND].bottom) { this->SetDirty(); - ResizeWindowForWidget(this, BRSW_BACKGROUND, 0, text_end - this->widget[BRSW_BACKGROUND].bottom); + ResizeWindowForWidget(this, BRSW_BACKGROUND, 0, top - this->widget[BRSW_BACKGROUND].bottom); this->SetDirty(); } } diff --git a/src/station_gui.h b/src/station_gui.h index b990779ae..fce0283c3 100644 --- a/src/station_gui.h +++ b/src/station_gui.h @@ -33,7 +33,7 @@ enum StationCoverageType { SCT_ALL }; -int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad, bool supplies); +int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies); void CheckRedrawStationCoverage(const Window *w); void ShowSelectStationIfNeeded(CommandContainer cmd, int w, int h); |