From f7f18f1593539aebc27faf88b596c2a406fc70f2 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Mon, 8 Oct 2007 00:51:03 -0700 Subject: [PATCH] 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 --- elevator.cpp | 3 +++ 1 file changed, 3 insertions(+) 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; } -- 2.34.1