Package: rrootage / 0.23a-12

10_deg_out_of_range.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
rrootage has its own trig routines. Angles are represented as a number
between 0 and DIV (= 1024), where DIV = 2pi. sin and cos are
implemented as a simple table lookup, so it's important that all
angles stay within this range. In the doChangeDirection method (called
from libbulletml), this restriction wasn't obeyed.

--- a/src/foecommand.cc
+++ b/src/foecommand.cc
@@ -76,7 +76,7 @@
 }
 
 void FoeCommand::doChangeDirection(double d) {
-  foe->d = (int)(d*DIV/360);
+  foe->d = (int)(d*DIV/360) & (DIV-1);
 }
 
 void FoeCommand::doChangeSpeed(double s) {