summaryrefslogtreecommitdiff
path: root/ship_gui.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-10-08 19:50:10 +0000
committerbjarni <bjarni@openttd.org>2006-10-08 19:50:10 +0000
commite397df0e0dcef8b6880450040c2ba2f7505ea02d (patch)
tree95168c29cb53a1e5fe9afb063e3ac434103a8675 /ship_gui.c
parentdf13aea113be3f0211c52f29c17e39f791e9545c (diff)
downloadopenttd-e397df0e0dcef8b6880450040c2ba2f7505ea02d.tar.xz
(svn r6693) -Fix: [ship view window] disable the refit button when the ship is not refitable or not stopped in a depot
Diffstat (limited to 'ship_gui.c')
-rw-r--r--ship_gui.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/ship_gui.c b/ship_gui.c
index 938dd0bf5..8dd4bd804 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -376,15 +376,12 @@ static void ShipViewWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
Vehicle *v = GetVehicle(w->window_number);
StringID str;
-
- /* Possible to refit? */
- if (ShipVehInfo(v->engine_type)->refittable && IsShipInDepotStopped(v)) {
- EnableWindowWidget(w, 7);
- EnableWindowWidget(w, 8);
- }
+ bool refitable_and_stopped_in_depot = ShipVehInfo(v->engine_type)->refittable && IsShipInDepotStopped(v);
SetWindowWidgetDisabledState(w, 7, v->owner != _local_player);
- SetWindowWidgetDisabledState(w, 8, v->owner != _local_player);
+ SetWindowWidgetDisabledState(w, 8,
+ v->owner != _local_player || // Disable if owner is not local player
+ !refitable_and_stopped_in_depot); // Disable if the ship is not refitable or stopped in a depot
/* draw widgets & caption */
SetDParam(0, v->string_id);