X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;f=elevator.cpp;h=cbf9775e860babd1d5530d5eac8d4bf9032b427e;hb=2172ce055533d5865d58538ee00bf609e59b0f99;hp=b8cdb5000afcbcec43649c1d2a3aaa8af0e19499;hpb=7a701939aeed1d48e00c4d557a81835b0c4a0de7;p=cs356-p1-elevator.git diff --git a/elevator.cpp b/elevator.cpp index b8cdb50..cbf9775 100644 --- a/elevator.cpp +++ b/elevator.cpp @@ -126,7 +126,7 @@ void Elevator::transition_move_up () position_ += ELEVATOR_STEP; // TODO: Call into the GUI to update the position - gui_update_position_label (number_, (float)position_); + gui_update_position_label (number_, (float)position_, direction_); std::cout << "Updating the GUI with our position: " << position_ << std::endl; } @@ -136,13 +136,15 @@ void Elevator::transition_move_down () position_ -= ELEVATOR_STEP; // TODO: Call into the GUI to update the position - gui_update_position_label (number_, (float)position_); + gui_update_position_label (number_, (float)position_, direction_); std::cout << "Updating the GUI with our position: " << position_ << std::endl; } void Elevator::transition_move_idle () { direction_ = IDLE; + // TODO: Call into the GUI to update the position + gui_update_position_label (number_, (float)position_, direction_); // do not change position while IDLE } @@ -193,6 +195,7 @@ void Elevator::transition_open_door () { stops_.remove (Stop(position_, direction_)); gui_unpress_call_button ((int)position_, direction_); + gui_unpress_request_button (number_, (int)position_); } // TODO: Call into the GUI to open the door @@ -516,6 +519,9 @@ void Elevator::move () bool Elevator::is_idle () const { + if (stops_.size() != 0) + return false; + return direction_ == IDLE; }