summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2006-11-14 00:02:02 +0000
committerglx <glx@openttd.org>2006-11-14 00:02:02 +0000
commit30bc338f908f8f0a741f3844b377cbc60e41b76b (patch)
treedc366442b4e7abb822005ad628fc12a198926a6a
parented46b7d3807f4cd6bfe3ace57faa41076ab3e998 (diff)
downloadopenttd-30bc338f908f8f0a741f3844b377cbc60e41b76b.tar.xz
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
-rw-r--r--aircraft_gui.c6
-rw-r--r--roadveh_gui.c8
-rw-r--r--ship_gui.c8
3 files changed, 14 insertions, 8 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 9bb7d020f..c488c1671 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -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 */
diff --git a/roadveh_gui.c b/roadveh_gui.c
index acf0173de..fef339163 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -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 */
diff --git a/ship_gui.c b/ship_gui.c
index 37505a8a9..0dbe32468 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -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);