Changeset 798:d2fd22159c9f for src


Ignore:
Timestamp:
07/26/16 17:27:46 (8 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The booked flight is passed to the aircraft created.

Location:
src/mlx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r797 r798  
    9898    """Base class for aircraft."""
    9999    @staticmethod
    100     def create(flight):
     100    def create(flight, bookedFlight):
    101101        """Create an aircraft instance for the type in the given flight."""
    102         return _classes[flight.aircraftType](flight)
     102        acft = _classes[flight.aircraftType](flight)
     103        acft.setBookedFlight(bookedFlight)
     104        return acft
    103105
    104106    def __init__(self, flight, minLandingFuel = None,
     
    279281        This default implementation returns DERATE_NONE."""
    280282        return DERATE_NONE
     283
     284    def setBookedFlight(self, bookedFlight):
     285        """Update the aircraft based on the booked flight data (e.g. tail number).
     286
     287        This default implementation does nothing."""
    281288
    282289    def getDerateLine(self, value):
  • src/mlx/gui/flight.py

    r777 r798  
    56465646    def _connectSimulator(self, simulatorType):
    56475647        """Connect to the simulator."""
    5648         self.gui.connectSimulator(self._bookedFlight.aircraftType,
    5649                                   simulatorType)
     5648        self.gui.connectSimulator(self._bookedFlight, simulatorType)
    56505649
    56515650    def _arrivalMETARCallback(self, returned, result):
  • src/mlx/gui/gui.py

    r769 r798  
    982982            self._stdioStartingLine = False
    983983
    984     def connectSimulator(self, aircraftType, simulatorType):
     984    def connectSimulator(self, bookedFlight, simulatorType):
    985985        """Connect to the simulator for the first time."""
    986986        self._logger.reset()
     
    988988        self._flight = flight.Flight(self._logger, self)
    989989        self._flight.flareTimeFromFS = self.config.flareTimeFromFS
    990         self._flight.aircraftType = aircraftType
    991         self._flight.aircraft = acft.Aircraft.create(self._flight)
     990        self._flight.aircraftType = bookedFlight.aircraftType
     991        self._flight.aircraft = acft.Aircraft.create(self._flight, bookedFlight)
    992992        self._flight.aircraft._checkers.append(self)
    993993
Note: See TracChangeset for help on using the changeset viewer.