From 520220b0cd9911c196b347c1ee707acd660f53a7 Mon Sep 17 00:00:00 2001 From: alanwatsonforster <68709385+alanwatsonforster@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:41:57 -0600 Subject: [PATCH] Tweaked logs. --- airpower/aircraft/__init__.py | 9 +-------- airpower/aircraft/_normalflight.py | 22 +++++++++++++++------- airpower/aircraft/_speed.py | 30 ++++++++++++++++-------------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/airpower/aircraft/__init__.py b/airpower/aircraft/__init__.py index 274ac8be..e3d0228c 100644 --- a/airpower/aircraft/__init__.py +++ b/airpower/aircraft/__init__.py @@ -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): @@ -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()) diff --git a/airpower/aircraft/_normalflight.py b/airpower/aircraft/_normalflight.py index 6246414e..d7fa7823 100644 --- a/airpower/aircraft/_normalflight.py +++ b/airpower/aircraft/_normalflight.py @@ -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: @@ -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) ######################################## @@ -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(): diff --git a/airpower/aircraft/_speed.py b/airpower/aircraft/_speed.py index 77cbe1d9..7b823102 100644 --- a/airpower/aircraft/_speed.py +++ b/airpower/aircraft/_speed.py @@ -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. @@ -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 + \ @@ -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. @@ -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: @@ -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.