From: Simon Cross Date: Sat, 5 Mar 2016 11:07:36 +0000 (+0200) Subject: Slightly more advanced roach seating. X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=2c4c2428ac247ea8fdac2aaf6b2373fbf0275e3c;p=koperkapel.git Slightly more advanced roach seating. --- diff --git a/koperkapel/vehicles/base.py b/koperkapel/vehicles/base.py index fb4640d..1b2f3ed 100644 --- a/koperkapel/vehicles/base.py +++ b/koperkapel/vehicles/base.py @@ -18,8 +18,19 @@ class Vehicle: def init_seats(self): raise NotImplementedError("Vehicles should specify a list of seats") + def assign_seats(self, seating): + for roach_name, seat in zip(seating, self.seats): + seat.roach = roach_name + _vehicle_types = {} + @classmethod + def current(cls, world): + vehicle = cls.by_type(world.vehicles.current) + vehicle.assign_seats( + world.vehicles[vehicle.vehicle_type].seating) + return vehicle + @classmethod def by_type(cls, vehicle_type): return cls._vehicle_types.get(vehicle_type)()