Author: per
Date: Wed Apr 12 16:58:40 2006
New Revision: 60

URL: http://svn.gna.org/viewcvs/warzone?rev=60&view=rev
Log:
When you load a savegame where two (enemy?) units are adjacent(?) to each 
other, its 
possible to hit a div by zero bug in visibility.c:visibleObject().

Problem occurs when rayCast() calls rayLOSCallback() and the callback exits due 
to 
(distSq >= tarDist) being true, without ever having executed the following 
block that 
updates lastD. lastD remains 0 and the divide at the end of visibleObject 
throws a 
SIGFPE. On any later occasion, the last distance value from the last 
calculation will be 
reused in this case, which is still bogus but isn't fatal.

The fix is easy, just add "lastD = dist;" before the return in the (distSq >= 
tarDist) 
case.

Patch by Angus Lees <gus> in bug #5761.

Modified:
    trunk/src/visibility.c


_______________________________________________
Warzone-commits mailing list
Warzone-commits@gna.org
https://mail.gna.org/listinfo/warzone-commits

Reply via email to