elif self.state >= self.CLOSED:
self.state = self.CLOSED
self.direction = 0
+ self.elevator.panel_prio = False
return True
def draw(self, surf):
self.destination = None
self.queued_dest = None
self.call_queue = []
+ self.panel_prio = False
+
+ def pop_destination(self, destination):
+ if destination == self.queued_dest:
+ self.queued_dest = None
+ while destination in self.call_queue:
+ self.call_queue.remove(destination)
+ self.destination = destination
def pick_destination(self):
"""
if not all(door.state == door.CLOSED for door in self.doors):
return False
if self.queued_dest is not None:
- self.destination = self.queued_dest
- while self.destination in self.call_queue:
- self.call_queue.remove(self.destination)
- self.queued_dest = None
+ self.pop_destination(self.queued_dest)
return True
- elif len(self.call_queue) > 0:
- self.destination = self.call_queue.pop(0)
- if self.destination == self.queued_dest:
- self.destination = None
+ elif not self.panel_prio and len(self.call_queue) > 0:
+ self.pop_destination(self.call_queue.pop(0))
+ self.panel_prio = True
return True
return False