#1865: divide by zero after game failure. -----------------------------------------------------------+---------------- Reporter: freakyd <iamabigwiener...@…> | Type: bug Status: new | Priority: major Milestone: unspecified | Component: Engine: Graphics Version: svn/trunk | Keywords: divide by zero Operating_system: All/Non-Specific | Blockedby: Blocking: | -----------------------------------------------------------+---------------- There's a divide by zero if your troops are moving and you fail the mission. I know there was another divide by zero problem, but it wasn't this one. It's interpolateangle, of course, but it's called from droid.h with the previous time equal to the current time, which causes the problem. I inserted logic so that if the current time and previous time are equal then I add to the current time. The net effect is things go double time when the mission fails, but the upside is no crash! droid.h: line 463 static inline Rotation getInterpolatedWeaponRotation(DROID *psDroid, int weaponSlot, uint32_t time) { if (psDroid->time == psDroid->prevSpacetime.time) { return interpolateRot(psDroid->asWeaps[weaponSlot].prevRot, psDroid->asWeaps[weaponSlot].rot, psDroid->prevSpacetime.time, psDroid->time+1, time); } else { return interpolateRot(psDroid->asWeaps[weaponSlot].prevRot, psDroid->asWeaps[weaponSlot].rot, psDroid->prevSpacetime.time, psDroid->time, time); } }
I'm sure someone can come up with a better idea than this, as I don't know the code very well. -- Ticket URL: <http://developer.wz2100.net/ticket/1865> Warzone 2100 Trac <http://developer.wz2100.net/> The Warzone 2100 Project _______________________________________________ Warzone-dev mailing list Warzone-dev@gna.org https://mail.gna.org/listinfo/warzone-dev