Skip to content

Commit

Permalink
Tweaked logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwatsonforster committed Oct 11, 2023
1 parent 57a008a commit 520220b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
9 changes: 1 addition & 8 deletions airpower/aircraft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def move(self, flighttype, power, actions, flamedoutengines=0):

self._log("configuration is %s." % self._configuration)
self._log("altitude band is %s." % self._altitudeband)
self._log("flight type is %s." % self._flighttype)
self._log("flight type is %s." % self._flighttype)

# See rule 8.1.4 on altitude carry.
if not _isclimbing(self._flighttype):
Expand Down Expand Up @@ -391,13 +391,6 @@ def _endmove(self):
else:
self._log("altitude band is unchanged at %s." % self._altitudeband)

if self._flighttype != "DP" and not self._maneuveringdeparture:
if self._altitudecarry != 0:
self._log("- carrying %.2f altitude levels." % self._altitudecarry)
self._log("- carrying %+.2f APs" % self._apcarry)
if self._flighttype != "ST":
self._log("- carrying %.1f FPs." % self._fpcarry)

self._finishedmove = True

self._save(ap.turn())
Expand Down
22 changes: 15 additions & 7 deletions airpower/aircraft/_normalflight.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,20 +1095,20 @@ def _startnormalflight(self, actions):
########################################

def reportapcarry():
self._log("- carrying %+.2f APs." % self._apcarry)
self._log("- is carrying %+.2f APs." % self._apcarry)

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

def reportaltitudecarry():
if self._altitudecarry != 0:
self._log("- carrying %.2f altitude levels." % self._altitudecarry)
self._log("- is carrying %.2f altitude levels." % self._altitudecarry)

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

def reportturn():

if self._maneuverfp > 0 and self._maneuvertype != None:
self._log("- is carrying %d FPs for %s%s." % (self._maneuverfp, self._maneuversense, self._maneuvertype))
self._log("- is carrying %d FPs for %s%s." % (self._maneuverfp, self._maneuvertype, self._maneuversense))
elif self._bank == None:
self._log("- has wings level.")
else:
Expand Down Expand Up @@ -1381,9 +1381,10 @@ def _endnormalflight(self):
########################################

def reportfp():
self._log("- used %d HFPs and %d VFPs (lost %.1f FPs to speedbrakes)." % (
self._log("- used %d HFPs and %d VFPs (and lost %.1f FPs to speedbrakes)." % (
self._hfp, self._vfp, self._spbrfp
))
self._log("- is carrying %.1f FPs." % self._fpcarry)

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

Expand Down Expand Up @@ -1441,12 +1442,19 @@ def reportturn():
self._gloccheck = 0

if self._maneuverfp > 0 and self._maneuvertype != None:
self._log("- carrying %d FPs for %s%s." % (self._maneuverfp, self._maneuversense, self._maneuvertype))
self._log("- is carrying %d FPs of %s%s." % (self._maneuverfp, self._maneuvertype, self._maneuversense))
elif self._bank == None:
self._log("- finished with wings level.")
self._log("- has wings level.")
else:
self._log("- banked %s." % self._bank)
self._log("- is banked %s." % self._bank)

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

def reportcarry():

if self._altitudecarry != 0:
self._log("- is carrying %.2f altitude levels." % self._altitudecarry)

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

def determinealtitudeap():
Expand Down
30 changes: 16 additions & 14 deletions airpower/aircraft/_speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ def _startmovespeed(self, power, flamedoutengines):
minspeed = self.minspeed()

if speed < ltspeed:
self._log("speed is %.1f." % speed)
self._log("speed is %.1f." % speed)
elif speed == ltspeed:
self._log("speed is %.1f (LT)." % speed)
self._log("speed is %.1f (LT)." % speed)
elif speed == htspeed:
self._log("speed is %.1f (HT)." % speed)
self._log("speed is %.1f (HT)." % speed)
else:
self._log("speed is %.1f (SS)." % speed)
self._log("speed is %.1f (SS)." % speed)

# See rule 6.4 on recovery from departed flight.

Expand Down Expand Up @@ -281,13 +281,13 @@ def _endmovespeed(self):

turnsap = self._turnrateap + self._sustainedturnap

self._log("- power APs = %+.2f." % self._powerap)
self._log("- speed APs = %+.2f." % self._speedap)
self._log("- altitude APs = %+.2f." % self._altitudeap)
self._log("- turns APs = %+.2f." % turnsap)
self._log("- other maneuvers APs = %+.2f." % self._othermaneuversap)
self._log("- speedbrakes APs = %+.2f." % self._spbrap)
self._log("- carry APs = %+.2f." % self._apcarry)
self._log("-- power APs = %+.2f." % self._powerap)
self._log("-- speed APs = %+.2f." % self._speedap)
self._log("-- altitude APs = %+.2f." % self._altitudeap)
self._log("-- turns APs = %+.2f." % turnsap)
self._log("-- other maneuvers APs = %+.2f." % self._othermaneuversap)
self._log("-- speedbrakes APs = %+.2f." % self._spbrap)
self._log("-- carry APs = %+.2f." % self._apcarry)
ap = \
self._powerap + \
self._speedap + \
Expand All @@ -296,7 +296,7 @@ def _endmovespeed(self):
self._othermaneuversap + \
self._spbrap + \
self._apcarry
self._log("- total APs = %+.2f." % ap)
self._log("-- total APs = %+.2f." % ap)

# See the "Speed Gain", "Speed Loss", and "Rapid Accel Aircraft" sections
# of rule 6.2 and the "Supersonic Speeds" section of rule 6.6.
Expand Down Expand Up @@ -360,6 +360,8 @@ def _endmovespeed(self):
self._speed += 0.5 * (ap // aprate)
self._apcarry = ap % aprate

self._log("- is carrying %+.2f APs." % self._apcarry)

if usemaxdivespeed:
maxspeed = self.maxdivespeed()
if self._speed > maxspeed:
Expand All @@ -372,9 +374,9 @@ def _endmovespeed(self):
self._speed = max(self._speed - 1, maxspeed)

if self._previousspeed != self._speed:
self._log("speed changed from %.1f to %.1f." % (self._previousspeed, self._speed))
self._log("speed changed from %.1f to %.1f." % (self._previousspeed, self._speed))
else:
self._log("speed is unchanged at %.1f." % self._speed)
self._log("speed is unchanged at %.1f." % self._speed)

# See rule 6.4.

Expand Down

0 comments on commit 520220b

Please sign in to comment.