summaryrefslogtreecommitdiff
path: root/vehicle_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 /vehicle_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 'vehicle_gui.c')
-rw-r--r--vehicle_gui.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 93bb054a6..9fab39658 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -1020,25 +1020,19 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
// or Both lists have the same vehicle selected
// or The selected replacement engine has a replacement (to prevent loops)
// or The right list (new replacement) has the existing replacement vehicle selected
- if (selected_id[0] == INVALID_ENGINE ||
+ SetWindowWidgetDisabledState(w, 4,
+ selected_id[0] == INVALID_ENGINE ||
selected_id[1] == INVALID_ENGINE ||
selected_id[0] == selected_id[1] ||
EngineReplacementForPlayer(p, selected_id[1]) != INVALID_ENGINE ||
- EngineReplacementForPlayer(p, selected_id[0]) == selected_id[1]) {
- SETBIT(w->disabled_state, 4);
- } else {
- CLRBIT(w->disabled_state, 4);
- }
+ EngineReplacementForPlayer(p, selected_id[0]) == selected_id[1]);
// Disable the "Stop Replacing" button if:
// The left list (existing vehicle) is empty
// or The selected vehicle has no replacement set up
- if (selected_id[0] == INVALID_ENGINE ||
- !EngineHasReplacementForPlayer(p, selected_id[0])) {
- SETBIT(w->disabled_state, 6);
- } else {
- CLRBIT(w->disabled_state, 6);
- }
+ SetWindowWidgetDisabledState(w, 6,
+ selected_id[0] == INVALID_ENGINE ||
+ !EngineHasReplacementForPlayer(p, selected_id[0]));
// now the actual drawing of the window itself takes place
SetDParam(0, _vehicle_type_names[WP(w, replaceveh_d).vehicletype - VEH_Train]);
@@ -1577,7 +1571,7 @@ static void DrawVehicleListWindow(Window *w)
DrawWindowWidgets(w);
- if (owner == _local_player && vl->l.list_length == 0) SETBIT(w->disabled_state, 9);
+ if (owner == _local_player && vl->l.list_length == 0) DisableWindowWidget(w, 9);
/* draw sorting criteria string */
DrawString(85, 15, _vehicle_sort_listing[vl->l.sort_type], 0x10);