summaryrefslogtreecommitdiff
path: root/aircraft_gui.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-10-03 02:08:15 +0000
committerbelugas <belugas@openttd.org>2006-10-03 02:08:15 +0000
commit753b5724001079c3352d23a911488044884dcf5b (patch)
treedc2a5593c6d3da96528beb914da8807aea2325e7 /aircraft_gui.c
parente383584988a99dbdfbcd4a63b1f11213a4274355 (diff)
downloadopenttd-753b5724001079c3352d23a911488044884dcf5b.tar.xz
(svn r6619) -Codechange: Use accessors for disabled_state.
Another step toward merging XTDwidget. The only two files not converted (window.h and widget.c) will be done at the very last commit)
Diffstat (limited to 'aircraft_gui.c')
-rw-r--r--aircraft_gui.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index 97b88c062..0a16fb793 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -121,7 +121,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
byte acc_planes;
if (tile == 0) {
- SETBIT(w->disabled_state, 5);
+ DisableWindowWidget(w, 5);
acc_planes = ALL;
} else {
acc_planes = GetAirport(GetStationByTile(tile)->airport_type)->acc_planes;
@@ -269,9 +269,11 @@ static void AircraftDetailsWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
const Vehicle *v = GetVehicle(w->window_number);
- w->disabled_state = v->owner == _local_player ? 0 : (1 << 2);
- if (!_patches.servint_aircraft) // disable service-scroller when interval is set to disabled
- w->disabled_state |= (1 << 5) | (1 << 6);
+ SetWindowWidgetDisabledState(w, 2, v->owner != _local_player);
+
+ /* Disable service-scroller when interval is set to disabled */
+ SetWindowWidgetDisabledState(w, 5, !_patches.servint_aircraft);
+ SetWindowWidgetDisabledState(w, 6, !_patches.servint_aircraft);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
@@ -451,13 +453,11 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e)
switch (e->event) {
case WE_PAINT: {
const Vehicle *v = GetVehicle(w->window_number);
- uint32 disabled = 1 << 8;
StringID str;
- if (IsAircraftInHangarStopped(v)) disabled = 0;
+ SetWindowWidgetDisabledState(w, 7, v->owner != _local_player);
+ SetWindowWidgetDisabledState(w, 8, !IsAircraftInHangarStopped(v) || v->owner != _local_player);
- if (v->owner != _local_player) disabled |= 1 << 8 | 1 << 7;
- w->disabled_state = disabled;
/* draw widgets & caption */
SetDParam(0, v->string_id);