mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r6693) -Fix: [ship view window] disable the refit button when the ship is not refitable or not stopped in a depot
This commit is contained in:
parent
df13aea113
commit
e397df0e0d
11
ship_gui.c
11
ship_gui.c
@ -376,15 +376,12 @@ static void ShipViewWndProc(Window *w, WindowEvent *e)
|
|||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
Vehicle *v = GetVehicle(w->window_number);
|
Vehicle *v = GetVehicle(w->window_number);
|
||||||
StringID str;
|
StringID str;
|
||||||
|
bool refitable_and_stopped_in_depot = ShipVehInfo(v->engine_type)->refittable && IsShipInDepotStopped(v);
|
||||||
/* Possible to refit? */
|
|
||||||
if (ShipVehInfo(v->engine_type)->refittable && IsShipInDepotStopped(v)) {
|
|
||||||
EnableWindowWidget(w, 7);
|
|
||||||
EnableWindowWidget(w, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetWindowWidgetDisabledState(w, 7, v->owner != _local_player);
|
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 */
|
/* draw widgets & caption */
|
||||||
SetDParam(0, v->string_id);
|
SetDParam(0, v->string_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user