Changeset 369:dcc9f8bd75dd


Ignore:
Timestamp:
12/16/12 16:33:38 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The aircraft's name and model are logged first when we enter the boarding stage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/acft.py

    r366 r369  
    6464        """Construct the aircraft for the given type."""
    6565        self._flight = flight
     66
     67        self._name = None
     68        self._modelName = None
     69
    6670        self._aircraftState = None
    6771
     
    201205    def modelChanged(self, timestamp, aircraftName, modelName):
    202206        """Called when the simulator's aircraft changes."""
    203         self._flight.logger.message(timestamp,
    204                                     "Aircraft: name='%s', model='%s'" % \
    205                                     (aircraftName, modelName))
     207        self._name = aircraftName
     208        self._modelName = modelName
     209        if self._flight.stage is not None:
     210            self._logNameAndModel(timestamp)
    206211
    207212    def handleState(self, aircraftState):
     
    240245        """Set the given stage as the new one and do whatever should be
    241246        done."""
     247        if newStage==const.STAGE_BOARDING:
     248            self._logNameAndModel(aircraftState.timestamp)
     249
    242250        if self._flight.setStage(aircraftState.timestamp, newStage):
    243251            if newStage==const.STAGE_PUSHANDTAXI:
     
    463471        self._adf2Logger.forceLog(flight, logger, aircraftState)
    464472
     473    def _logNameAndModel(self, timestamp):
     474        """Log the aircraft's name and model with taking the timestamp from the
     475        given state."""
     476        self._flight.logger.message(timestamp,
     477                                    "Aircraft: name='%s', model='%s'" % \
     478                                    (self._name, self._modelName))
     479
    465480#---------------------------------------------------------------------------------------
    466481
Note: See TracChangeset for help on using the changeset viewer.