summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/airport_gui.cpp4
-rw-r--r--src/bridge_gui.cpp4
-rw-r--r--src/dock_gui.cpp10
-rw-r--r--src/rail_gui.cpp16
-rw-r--r--src/road_gui.cpp12
-rw-r--r--src/window.cpp4
-rw-r--r--src/window_gui.h2
7 files changed, 26 insertions, 26 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index a8d657736..18162a785 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -126,7 +126,7 @@ struct BuildAirToolbarWindow : Window {
{
this->RaiseButtons();
- DeleteWindowById(WC_BUILD_STATION, 0);
+ DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
DeleteWindowById(WC_SELECT_STATION, 0);
}
};
@@ -202,7 +202,7 @@ enum AirportPickerWidgets {
class AirportPickerWindow : public PickerWindowBase {
public:
- AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
+ AirportPickerWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_AIR)
{
this->SetWidgetLoweredState(BAW_BTN_DONTHILIGHT, !_settings_client.gui.station_show_coverage);
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index acf67083b..7f0c1a3eb 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -118,7 +118,7 @@ private:
}
public:
- BuildBridgeWindow(const WindowDesc *desc, TileIndex start, TileIndex end, uint32 br_type, GUIBridgeList *bl) : Window(desc),
+ BuildBridgeWindow(const WindowDesc *desc, TileIndex start, TileIndex end, uint32 br_type, GUIBridgeList *bl) : Window(desc, GB(br_type, 15, 2)),
start_tile(start),
end_tile(end),
type(br_type),
@@ -308,7 +308,7 @@ static const WindowDesc _build_bridge_desc(
*/
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type)
{
- DeleteWindowById(WC_BUILD_BRIDGE, 0);
+ DeleteWindowByClass(WC_BUILD_BRIDGE);
/* Data type for the bridge.
* Bit 16,15 = transport type,
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 3c4e08905..f7aed41ed 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -241,10 +241,10 @@ struct BuildDocksToolbarWindow : Window {
{
this->RaiseButtons();
- DeleteWindowById(WC_BUILD_STATION, 0);
- DeleteWindowById(WC_BUILD_DEPOT, 0);
+ DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
+ DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
DeleteWindowById(WC_SELECT_STATION, 0);
- DeleteWindowById(WC_BUILD_BRIDGE, 0);
+ DeleteWindowByClass(WC_BUILD_BRIDGE);
}
virtual void OnPlacePresize(Point pt, TileIndex tile_from)
@@ -341,7 +341,7 @@ struct BuildDocksStationWindow : public PickerWindowBase {
public:
BuildDocksStationWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
{
- this->InitNested(desc);
+ this->InitNested(desc, TRANSPORT_WATER);
this->LowerWidget(_settings_client.gui.station_show_coverage + BDSW_LT_OFF);
}
@@ -447,7 +447,7 @@ private:
public:
BuildDocksDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
{
- this->InitNested(desc);
+ this->InitNested(desc, TRANSPORT_WATER);
this->LowerWidget(_ship_depot_direction + BDDW_X);
UpdateDocksDirection();
}
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 82fc959ca..bcb21d63d 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -766,11 +766,11 @@ struct BuildRailToolbarWindow : Window {
this->DisableWidget(RTW_REMOVE);
this->InvalidateWidget(RTW_REMOVE);
- DeleteWindowById(WC_BUILD_SIGNAL, 0);
- DeleteWindowById(WC_BUILD_STATION, 0);
- DeleteWindowById(WC_BUILD_DEPOT, 0);
+ DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
+ DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
+ DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
DeleteWindowById(WC_SELECT_STATION, 0);
- DeleteWindowById(WC_BUILD_BRIDGE, 0);
+ DeleteWindowByClass(WC_BUILD_BRIDGE);
}
virtual void OnPlacePresize(Point pt, TileIndex tile)
@@ -986,7 +986,7 @@ public:
BuildRailStationWindow(const WindowDesc *desc, Window *parent, bool newstation) : PickerWindowBase(parent)
{
this->line_height = FONT_HEIGHT_NORMAL + 4;
- this->InitNested(desc);
+ this->InitNested(desc, TRANSPORT_RAIL);
this->LowerWidget(_railstation.orientation + BRSW_PLATFORM_DIR_X);
if (_settings_client.gui.station_dragdrop) {
@@ -1470,7 +1470,7 @@ private:
}
public:
- BuildSignalWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
+ BuildSignalWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_RAIL)
{
this->FindWindowPlacementAndResize(desc);
};
@@ -1639,7 +1639,7 @@ enum BuildRailDepotWidgets {
};
struct BuildRailDepotWindow : public PickerWindowBase {
- BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
+ BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_RAIL)
{
this->LowerWidget(_build_depot_direction + BRDW_DEPOT_NE);
this->FindWindowPlacementAndResize(desc);
@@ -1740,7 +1740,7 @@ enum BuildRailWaypointWidgets {
};
struct BuildRailWaypointWindow : PickerWindowBase {
- BuildRailWaypointWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
+ BuildRailWaypointWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_RAIL)
{
this->hscroll.cap = 5;
this->hscroll.count = _waypoint_count;
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index aa38c4923..5ce82268c 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -528,11 +528,11 @@ struct BuildRoadToolbarWindow : Window {
this->InvalidateWidget(RTW_REMOVE);
this->InvalidateWidget(RTW_ONE_WAY);
- DeleteWindowById(WC_BUS_STATION, 0);
- DeleteWindowById(WC_TRUCK_STATION, 0);
- DeleteWindowById(WC_BUILD_DEPOT, 0);
+ DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
+ DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
+ DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
DeleteWindowById(WC_SELECT_STATION, 0);
- DeleteWindowById(WC_BUILD_BRIDGE, 0);
+ DeleteWindowByClass(WC_BUILD_BRIDGE);
}
virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt)
@@ -796,7 +796,7 @@ enum BuildRoadDepotWidgets {
};
struct BuildRoadDepotWindow : public PickerWindowBase {
- BuildRoadDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
+ BuildRoadDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent, TRANSPORT_ROAD)
{
this->LowerWidget(_road_depot_orientation + BRDW_DEPOT_NE);
if ( _cur_roadtype == ROADTYPE_TRAM) {
@@ -907,7 +907,7 @@ enum BuildRoadStationWidgets {
};
struct BuildRoadStationWindow : public PickerWindowBase {
- BuildRoadStationWindow(const WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent)
+ BuildRoadStationWindow(const WindowDesc *desc, Window *parent, RoadStopType rs) : PickerWindowBase(desc, parent, TRANSPORT_ROAD)
{
/* Trams don't have non-drivethrough stations */
if (_cur_roadtype == ROADTYPE_TRAM && _road_station_picker_orientation < DIAGDIR_END) {
diff --git a/src/window.cpp b/src/window.cpp
index 00e42ff72..60519f3ee 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1198,7 +1198,7 @@ restart:
*
* By default position a child window at an offset of 10/10 of its parent.
* With the exception of WC_BUILD_TOOLBAR (build railway/roads/ship docks/airports)
- * and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/36 of
+ * and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/toolbar-height of
* its parent. So it's exactly under the parent toolbar and no buttons will be covered.
* However if it falls too extremely outside window positions, reposition
* it to an automatic place.
@@ -1226,7 +1226,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int
if (pt.x > _screen.width + 10 - default_width) {
pt.x = (_screen.width + 10 - default_width) - 20;
}
- pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? 36 : 10);
+ pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? w->height : 10);
} else {
switch (desc->left) {
case WDP_ALIGN_TBR: // Align the right side with the top toolbar
diff --git a/src/window_gui.h b/src/window_gui.h
index 387dab1f6..3cb1fa9f6 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -709,7 +709,7 @@ public:
class PickerWindowBase : public Window {
public:
- PickerWindowBase(const WindowDesc *desc, Window *parent) : Window(desc)
+ PickerWindowBase(const WindowDesc *desc, Window *parent, WindowNumber number = 0) : Window(desc, number)
{
this->parent = parent;
};