# HG changeset patch # User bjarni # Date 1160337010 0 # Node ID e74142f0d7d83eb54869f002c715dda96b32ac50 # Parent c094f7d950113f54bd2310ae570d41883df0babd (svn r6693) -Fix: [ship view window] disable the refit button when the ship is not refitable or not stopped in a depot diff -r c094f7d95011 -r e74142f0d7d8 ship_gui.c --- a/ship_gui.c Sun Oct 08 19:43:35 2006 +0000 +++ b/ship_gui.c Sun Oct 08 19:50:10 2006 +0000 @@ -376,15 +376,12 @@ 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);