(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)
This commit is contained in:
belugas
2006-10-02 00:28:31 +00:00
parent 33e8c26c38
commit f5ee5bdb0e
8 changed files with 46 additions and 28 deletions

View File

@@ -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;
bool plane_stopped = IsAircraftInHangarStopped(v);
if (h != w->hidden_state) {
w->hidden_state = h;
/* 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;