(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)

pull/155/head
glx 18 years ago
parent 0724b07575
commit bc512e719f

@ -215,9 +215,11 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
const Vehicle *v = GetVehicle(w->window_number);
StringID str;
bool is_localplayer = v->owner == _local_player;
SetWindowWidgetDisabledState(w, 7, v->owner != _local_player);
SetWindowWidgetDisabledState(w, 8, !IsAircraftInHangarStopped(v) || v->owner != _local_player);
SetWindowWidgetDisabledState(w, 7, !is_localplayer);
SetWindowWidgetDisabledState(w, 8, !IsAircraftInHangarStopped(v) || !is_localplayer);
SetWindowWidgetDisabledState(w, 11, !is_localplayer);
/* draw widgets & caption */

@ -235,11 +235,13 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
Vehicle *v = GetVehicle(w->window_number);
StringID str;
bool is_localplayer = v->owner == _local_player;
SetWindowWidgetDisabledState(w, 7, v->owner != _local_player);
SetWindowWidgetDisabledState(w, 8, v->owner != _local_player);
SetWindowWidgetDisabledState(w, 7, !is_localplayer);
SetWindowWidgetDisabledState(w, 8, !is_localplayer);
SetWindowWidgetDisabledState(w, 11, !is_localplayer);
/* Disable refit button if vehicle not refittable */
SetWindowWidgetDisabledState(w, 12, v->owner != _local_player ||
SetWindowWidgetDisabledState(w, 12, !is_localplayer ||
_engine_info[v->engine_type].refit_mask == 0);
/* draw widgets & caption */

@ -380,11 +380,13 @@ static void ShipViewWndProc(Window *w, WindowEvent *e)
Vehicle *v = GetVehicle(w->window_number);
StringID str;
bool refitable_and_stopped_in_depot = ShipVehInfo(v->engine_type)->refittable && IsShipInDepotStopped(v);
bool is_localplayer = v->owner == _local_player;
SetWindowWidgetDisabledState(w, 7, v->owner != _local_player);
SetWindowWidgetDisabledState(w, 8,
v->owner != _local_player || // Disable if owner is not local player
SetWindowWidgetDisabledState(w, 7, !is_localplayer);
SetWindowWidgetDisabledState(w, 8,
!is_localplayer || // Disable if owner is not local player
!refitable_and_stopped_in_depot); // Disable if the ship is not refitable or stopped in a depot
SetWindowWidgetDisabledState(w, 11, !is_localplayer);
/* draw widgets & caption */
SetDParam(0, v->string_id);

Loading…
Cancel
Save