summaryrefslogtreecommitdiffhomepage
path: root/digital/io-hub/src/apbirthday/top.cc
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io-hub/src/apbirthday/top.cc')
-rw-r--r--digital/io-hub/src/apbirthday/top.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/digital/io-hub/src/apbirthday/top.cc b/digital/io-hub/src/apbirthday/top.cc
index 0fb37ca1..3f7bf2a5 100644
--- a/digital/io-hub/src/apbirthday/top.cc
+++ b/digital/io-hub/src/apbirthday/top.cc
@@ -47,7 +47,8 @@ top_cake_angle (const vect_t &pos)
float dx = pos.x - pg_cake_pos.x;
float dy = pos.y - pg_cake_pos.y;
float angle_rad = std::atan2 (dy, dx);
- uint16_t angle = angle_rad * ((1 << 16) / (2 * M_PI));
+ // Be careful not to lose sign during conversion.
+ int16_t angle = angle_rad * ((1 << 16) / (2 * M_PI));
return angle;
}