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 /aircraft_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 'aircraft_gui.c')
-rw-r--r-- | aircraft_gui.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c index 8b503bd3c..97b88c062 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -552,10 +552,14 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) case WE_MOUSELOOP: { const Vehicle *v = GetVehicle(w->window_number); - uint32 h = IsAircraftInHangarStopped(v) ? 1 << 7 : 1 << 11; - - if (h != w->hidden_state) { - w->hidden_state = h; + bool plane_stopped = IsAircraftInHangarStopped(v); + + /* Widget 7 (send to hangar) must be hidden if the plane is already stopped in hangar. + * Widget 11 (clone) should then be shown, since cloning is allowed only while in hangar and stopped. + * This sytem allows to have two buttons, on top of each other*/ + if (plane_stopped != IsWindowWidgetHidden(w, 7) || plane_stopped == IsWindowWidgetHidden(w, 11)) { + SetWindowWidgetHiddenState(w, 7, plane_stopped); // send to hangar + SetWindowWidgetHiddenState(w, 11, !plane_stopped); // clone SetWindowDirty(w); } } break; |