Skip to content

Commit

Permalink
Improved __str__.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwatsonforster committed Sep 24, 2023
1 parent 6f6ab1f commit c30974f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions airpower/aircraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,25 @@ def __init__(self, name, hexcode, azimuth, altitude, speed):
self._drawaircraft("end")

def __str__(self):
return "[name: %s]" % self._name
s = ""
for x in [
["name" , self._name],
["turn" , self._turn],
["sheet" , apmap.tosheet(self._x, self._y) if not self._leftmap else "-- "],
["hexcode" , aphexcode.fromxy(self._x, self._y) if not self._leftmap else "----"],
["facing" , apazimuth.fromfacing(self._facing)],
["speed" , self._speed],
["fpcarry" , self._fpcarry],
["apcarry" , self._apcarry],
["altitude" , self._altitude],
["altitudecarry", self._altitudecarry],
["destroyed" , self._destroyed],
["leftmap" , self._leftmap],
]:
s += "%-16s: %s\n" % (x[0], x[1])
return s

##############################################################################
##############################################################################

# Drawing

Expand Down

0 comments on commit c30974f

Please sign in to comment.