Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Floating point arithmetic exception on ShipAICmd.cpp #4288
To replicate: Go to star system referenced in the attached file. Target the first planet orbiting the black hole (BH1b1), hit autopilot, and "enter low orbit around BH1b1".
I re-implemented the std::max function locally to make debugging easier, but the same exception happens with current master (4d32739). It looks like there's a max operation being done on the xmm1 and xmm2 registers being done before returning, for some reason. I'm not sure why this is happening. The greater than comparison is being done in the ucomisd instruction a couple of lines above. And nonsense data (0x800000....) seems to be loaded into xmm1.
I'll work on this further, I just wanted to put it out there for everyone else to look at.
The black hole is coming out of the sysgen with zero radius. The terrain code has no idea what to do with a zero-radius body, so the terrain feature height comes out as a NaN which is passed through to the black hole's m_physradius. This throws an exception in the autopilot, because we enable exceptions around it.
I don't know what physical radius black holes are supposed to have. Maybe the event horizon?