projects
/
cs356-p1-elevator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Get the Play/Pause and Quit buttons working nicely
[cs356-p1-elevator.git]
/
elevator.cpp
diff --git
a/elevator.cpp
b/elevator.cpp
index
62dfb19
..
cbf9775
100644
(file)
--- 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
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;
}
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
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;
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
}
// do not change position while IDLE
}
@@
-517,6
+519,9
@@
void Elevator::move ()
bool Elevator::is_idle () const
{
bool Elevator::is_idle () const
{
+ if (stops_.size() != 0)
+ return false;
+
return direction_ == IDLE;
}
return direction_ == IDLE;
}