From: Ira W. Snyder Date: Mon, 8 Oct 2007 07:51:03 +0000 (-0700) Subject: Make Elevator idleness depend on number of stops X-Git-Url: https://irasnyder.com/gitweb/?a=commitdiff_plain;h=f7f18f1593539aebc27faf88b596c2a406fc70f2;p=cs356-p1-elevator.git Make Elevator idleness depend on number of stops This makes the Elevator's is_idle() method depend not only on its current state, but on the likelihood that it will be non-idle very soon. If the Elevator has no stops, and its direction is IDLE, then we can really consider it idle. Signed-off-by: Ira W. Snyder --- diff --git a/elevator.cpp b/elevator.cpp index 62dfb19..f2be628 100644 --- a/elevator.cpp +++ b/elevator.cpp @@ -517,6 +517,9 @@ void Elevator::move () bool Elevator::is_idle () const { + if (stops_.size() != 0) + return false; + return direction_ == IDLE; }