summaryrefslogtreecommitdiff
path: root/roadveh_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 /roadveh_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 'roadveh_gui.c')
-rw-r--r--roadveh_gui.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 2a5066c1f..fa073b343 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -86,9 +86,10 @@ static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
const Vehicle *v = GetVehicle(w->window_number);
StringID str;
- w->disabled_state = v->owner == _local_player ? 0 : (1 << 2);
+ SetWindowWidgetDisabledState(w, 2, v->owner != _local_player);
// disable service-scroller when interval is set to disabled
- if (!_patches.servint_roadveh) w->disabled_state |= (1 << 5) | (1 << 6);
+ SetWindowWidgetDisabledState(w, 5, !_patches.servint_roadveh);
+ SetWindowWidgetDisabledState(w, 6, !_patches.servint_roadveh);
SetDParam(0, v->string_id);
SetDParam(1, v->unitnumber);
@@ -236,10 +237,11 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
Vehicle *v = GetVehicle(w->window_number);
StringID str;
- w->disabled_state = (v->owner != _local_player) ? (1 << 8 | 1 << 7 | 1 << 12) : 0;
-
+ SetWindowWidgetDisabledState(w, 7, v->owner != _local_player);
+ SetWindowWidgetDisabledState(w, 8, v->owner != _local_player);
/* Disable refit button if vehicle not refittable */
- if (_engine_info[v->engine_type].refit_mask == 0) SETBIT(w->disabled_state, 12);
+ SetWindowWidgetDisabledState(w, 12, v->owner != _local_player ||
+ _engine_info[v->engine_type].refit_mask == 0);
/* draw widgets & caption */
SetDParam(0, v->string_id);
@@ -403,7 +405,7 @@ static void DrawNewRoadVehWindow(Window *w)
int sel;
int y;
- if (w->window_number == 0) w->disabled_state = 1 << 5;
+ SetWindowWidgetDisabledState(w, 5, w->window_number == 0);
count = 0;
for (e = ROAD_ENGINES_INDEX; e < ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES; e++) {
@@ -541,3 +543,4 @@ void ShowBuildRoadVehWindow(TileIndex tile)
}
}
+