BUGFIX: Elevators did not handle Requests in the correct order
[cs356-p1-elevator.git] / elevatorgui.cpp
index 3db7c3d..f18a334 100644 (file)
@@ -247,6 +247,10 @@ void ElevatorGUI::gui_unpress_call_button (int floor, Direction direction)
 {
        CallButtonVector::iterator it;
 
+       /* If there is still an elevator coming, don't turn it off! */
+       if (ec_.oneElevatorWillStillStopAt (floor, direction))
+               return;
+
        for (it=call_buttons_.begin(); it!=call_buttons_.end(); it++)
                if ((*it)->getFloorNumber() == floor && (*it)->getDirection() == direction)
                        (*it)->set_active (false);