diff --git a/airpower/aircraft/__init__.py b/airpower/aircraft/__init__.py index c2ed7f0e..02fa6c02 100644 --- a/airpower/aircraft/__init__.py +++ b/airpower/aircraft/__init__.py @@ -87,6 +87,20 @@ def __str__(self): s += "%-16s: %s\n" % (x[0], x[1]) return s + def position(self): + + if apmap.isonmap(self._x, self._y): + sheet = apmap.tosheet(self._x, self._y) + hexcode = aphexcode.fromxy(self._x, self._y) + else: + sheet = "--" + hexcode = "----" + azimuth = apazimuth.fromfacing(self._facing) + altitude = self._altitude + altitudeband = self._altitudeband + return "%2s %-9s %-3s %2d %2s" % (sheet, hexcode, azimuth, altitude, altitudeband) + + ############################################################################# def checkforterraincollision(self): diff --git a/airpower/aircraft/_log.py b/airpower/aircraft/_log.py index f2826c28..e8974b58 100644 --- a/airpower/aircraft/_log.py +++ b/airpower/aircraft/_log.py @@ -16,18 +16,7 @@ def _logbreak(self): def _logposition(self, s, t): - if apmap.isonmap(self._x, self._y): - sheet = apmap.tosheet(self._x, self._y) - hexcode = aphexcode.fromxy(self._x, self._y) - else: - sheet = "--" - hexcode = "----" - azimuth = apazimuth.fromfacing(self._facing) - altitude = self._altitude - altitudeband = self._altitudeband - position = "%2s %-9s %-3s %2d %2s" % (sheet, hexcode, azimuth, altitude, altitudeband) - - self._log("%-5s : %-16s : %s" % (s, t, position)) + self._log("%-5s : %-16s : %s" % (s, t, self.position())) def _logevent(self, s): self._log("%-5s : %s" % ("", s))