rrootage (0.23a-9) 10_deg_out_of_range.patch

Summary

 src/foecommand.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

    
download this patch

Patch contents

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) {