summaryrefslogtreecommitdiff
path: root/src/road_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-27 14:15:48 +0000
committerrubidium <rubidium@openttd.org>2007-06-27 14:15:48 +0000
commit1cff4725010b20d39cbf5781dd3251112a004e8c (patch)
treeeaa49e95c6bd9507f25d0920157782b69f1e373f /src/road_gui.cpp
parentf603383eb9a11b6b951910933fcab305c6c1fe68 (diff)
downloadopenttd-1cff4725010b20d39cbf5781dd3251112a004e8c.tar.xz
(svn r10353) -Fix/Feature [FS#669]: disallow (in the GUI) the building of infrastructure you do not have available vehicles for. This means that the airport building button is disabled till you can actually build aircraft. The game itself will not disallow you to build the infrastructure and this "new" behaviour can be overriden with a patch setting.
Diffstat (limited to 'src/road_gui.cpp')
-rw-r--r--src/road_gui.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 66e566ad1..405f7a4dc 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -213,19 +213,19 @@ static void BuildRoadClick_Demolish(Window *w)
static void BuildRoadClick_Depot(Window *w)
{
- if (_game_mode == GM_EDITOR) return;
+ if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(w, RTW_DEPOT, SPR_CURSOR_ROAD_DEPOT, 1, PlaceRoad_Depot)) ShowRoadDepotPicker();
}
static void BuildRoadClick_BusStation(Window *w)
{
- if (_game_mode == GM_EDITOR) return;
+ if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(w, RTW_BUS_STATION, SPR_CURSOR_BUS_STATION, 1, PlaceRoad_BusStation)) ShowRVStationPicker(RoadStop::BUS);
}
static void BuildRoadClick_TruckStation(Window *w)
{
- if (_game_mode == GM_EDITOR) return;
+ if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD)) return;
if (HandlePlacePushButton(w, RTW_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, 1, PlaceRoad_TruckStation)) ShowRVStationPicker(RoadStop::TRUCK);
}
@@ -270,6 +270,7 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
if (IsWindowWidgetLowered(w, RTW_ROAD_X) || IsWindowWidgetLowered(w, RTW_ROAD_Y) || IsWindowWidgetLowered(w, RTW_BUS_STATION) || IsWindowWidgetLowered(w, RTW_TRUCK_STATION)) {
EnableWindowWidget(w, RTW_REMOVE);
}
+ SetWindowWidgetsDisabledState(w, !CanBuildVehicleInfrastructure(VEH_ROAD), 6, 7, 8, WIDGET_LIST_END);
DrawWindowWidgets(w);
break;