diff options
author | belugas <belugas@openttd.org> | 2006-10-03 02:08:15 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2006-10-03 02:08:15 +0000 |
commit | 753b5724001079c3352d23a911488044884dcf5b (patch) | |
tree | dc2a5593c6d3da96528beb914da8807aea2325e7 /depot_gui.c | |
parent | e383584988a99dbdfbcd4a63b1f11213a4274355 (diff) | |
download | openttd-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 'depot_gui.c')
-rw-r--r-- | depot_gui.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/depot_gui.c b/depot_gui.c index 83554a89d..c52dfed7a 100644 --- a/depot_gui.c +++ b/depot_gui.c @@ -258,17 +258,20 @@ static void ShowDepotSellAllWindow(TileIndex tile, byte type) static void DrawDepotWindow(Window *w) { Vehicle **vl = WP(w, depot_d).vehicle_list; - TileIndex tile; + TileIndex tile = w->window_number; int x, y, i, hnum, max; uint16 num = WP(w, depot_d).engine_count; - - tile = w->window_number; + bool is_localplayer = IsTileOwner(tile, _local_player); /* setup disabled buttons */ - w->disabled_state = - IsTileOwner(tile, _local_player) ? 0 : ( (1 << DEPOT_WIDGET_STOP_ALL) | (1 << DEPOT_WIDGET_START_ALL) | - (1 << DEPOT_WIDGET_SELL) | (1 << DEPOT_WIDGET_SELL_CHAIN) | (1 << DEPOT_WIDGET_SELL_ALL) | - (1 << DEPOT_WIDGET_BUILD) | (1 << DEPOT_WIDGET_CLONE) | (1 << DEPOT_WIDGET_AUTOREPLACE)); + SetWindowWidgetDisabledState(w, DEPOT_WIDGET_STOP_ALL, !is_localplayer); + SetWindowWidgetDisabledState(w, DEPOT_WIDGET_START_ALL, !is_localplayer); + SetWindowWidgetDisabledState(w, DEPOT_WIDGET_SELL, !is_localplayer); + SetWindowWidgetDisabledState(w, DEPOT_WIDGET_SELL_CHAIN, !is_localplayer); + SetWindowWidgetDisabledState(w, DEPOT_WIDGET_SELL_ALL, !is_localplayer); + SetWindowWidgetDisabledState(w, DEPOT_WIDGET_BUILD, !is_localplayer); + SetWindowWidgetDisabledState(w, DEPOT_WIDGET_CLONE, !is_localplayer); + SetWindowWidgetDisabledState(w, DEPOT_WIDGET_AUTOREPLACE, !is_localplayer); /* determine amount of items for scroller */ if (WP(w, depot_d).type == VEH_Train) { @@ -740,14 +743,14 @@ static void DepotWndProc(Window *w, WindowEvent *e) } break; case DEPOT_WIDGET_SELL: case DEPOT_WIDGET_SELL_CHAIN: - if (!HASBIT(w->disabled_state, DEPOT_WIDGET_SELL) && + if (!IsWindowWidgetDisabled(w, DEPOT_WIDGET_SELL) && WP(w, depot_d).sel != INVALID_VEHICLE) { Vehicle *v; uint command; int sell_cmd; bool is_engine; - if (HASBIT(w->disabled_state, e->we.click.widget)) return; + if (IsWindowWidgetDisabled(w, e->we.click.widget)) return; if (WP(w, depot_d).sel == INVALID_VEHICLE) return; HandleButtonClick(w, e->we.click.widget); |