Make Elevator idleness depend on number of stops
authorIra W. Snyder <devel@irasnyder.com>
Mon, 8 Oct 2007 07:51:03 +0000 (00:51 -0700)
committerIra W. Snyder <devel@irasnyder.com>
Mon, 8 Oct 2007 07:51:03 +0000 (00:51 -0700)
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 <devel@irasnyder.com>
elevator.cpp

index 62dfb19..f2be628 100644 (file)
@@ -517,6 +517,9 @@ void Elevator::move ()
 
 bool Elevator::is_idle () const
 {
+       if (stops_.size() != 0)
+               return false;
+
        return direction_ == IDLE;
 }