From 9bd6f9ef47475e936d2abe052bb56fd30d0d2fbb Mon Sep 17 00:00:00 2001 From: bgreman <47828384+bgreman@users.noreply.github.com> Date: Wed, 30 Jun 2021 23:58:20 -0400 Subject: [PATCH] Addresses #478 to clean up the angle summing functionality. (#1386) --- changelog.md | 2 ++ game/utils.py | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index b75fab07..09058d82 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,8 @@ Saves from 4.0.0 are compatible with 4.0.1. ## Fixes * **[UI]** Statistics window tick marks are now always integers. +* **[Flight Planning]** Fixed potential issue with angles > 360° or < 0° being generated when summing two angles. + # 4.0.0 Saves from 3.x are not compatible with 4.0. diff --git a/game/utils.py b/game/utils.py index 0bd1f79c..68e38d31 100644 --- a/game/utils.py +++ b/game/utils.py @@ -18,12 +18,7 @@ KPH_TO_MS = 1 / MS_TO_KPH def heading_sum(h, a) -> int: h += a - if h > 360: - return h - 360 - elif h < 0: - return 360 + h - else: - return h + return h % 360 def opposite_heading(h):