diff options
author | belugas <belugas@openttd.org> | 2006-10-02 00:28:31 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2006-10-02 00:28:31 +0000 |
commit | 2c45339e0ae0fa0b466b725eb2280a16a5b167d5 (patch) | |
tree | 824c32c54efb62eb8db1cd43c94dbe8c28a30b9a /roadveh_gui.c | |
parent | 21591b5219a99a9d798c43dc2d89e7d00475f7cd (diff) | |
download | openttd-2c45339e0ae0fa0b466b725eb2280a16a5b167d5.tar.xz |
(svn r6612) -Codechange: Use accessors for hidden_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.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/roadveh_gui.c b/roadveh_gui.c index 01c8f459e..2a5066c1f 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -337,13 +337,19 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number); break; - case WE_MOUSELOOP: - { + case WE_MOUSELOOP: { const Vehicle *v = GetVehicle(w->window_number); - uint32 h = IsRoadVehInDepotStopped(v) ? 1 << 7 | 1 << 8 : 1 << 11 | 1 << 12; - - if (h != w->hidden_state) { - w->hidden_state = h; + bool rv_stopped = IsRoadVehInDepotStopped(v); + + /* Widget 7 (send to depot) must be hidden if the truck/bus is already stopped in depot. + * Widget 11 (clone) should then be shown, since cloning is allowed only while in depot and stopped. + * This sytem allows to have two buttons, on top of each other. + * The same system applies to widget 8 and 12, force turn around and refit. */ + if (rv_stopped != IsWindowWidgetHidden(w, 7) || rv_stopped == IsWindowWidgetHidden(w, 11)) { + SetWindowWidgetHiddenState(w, 7, rv_stopped); // send to depot + SetWindowWidgetHiddenState(w, 8, rv_stopped); // force turn around + SetWindowWidgetHiddenState(w, 11, !rv_stopped); // clone + SetWindowWidgetHiddenState(w, 12, !rv_stopped); // refit SetWindowDirty(w); } } |