Fixed: #963 Floating point exceptions

This commit is contained in:
kervala 2010-06-05 10:50:04 +02:00
parent 53ee26bd43
commit 0f94026dfe
2 changed files with 10 additions and 4 deletions

View file

@ -25,12 +25,15 @@ namespace NLSOUND
// common method used only with OptionManualRolloff. return the volume in 1/100th DB ( = mB) modified // common method used only with OptionManualRolloff. return the volume in 1/100th DB ( = mB) modified
sint32 ISource::computeManualRollOff(sint32 volumeMB, sint32 mbMin, sint32 mbMax, double alpha, float sqrdist, float distMin, float distMax) sint32 ISource::computeManualRollOff(sint32 volumeMB, sint32 mbMin, sint32 mbMax, double alpha, float sqrdist, float distMin, float distMax)
{ {
// root square of max float value
static float maxSqrt = sqrt(std::numeric_limits<float>::max());
if (sqrdist < distMin * distMin) if (sqrdist < distMin * distMin)
{ {
// no attenuation // no attenuation
return volumeMB; return volumeMB;
} }
else if (sqrdist > distMax * distMax) else if ((distMax < maxSqrt) && (sqrdist > distMax * distMax))
{ {
// full attenuation // full attenuation
return mbMin; return mbMin;

View file

@ -322,7 +322,7 @@ std::string DebugUIFilter;
bool ShowHelp = false; // Do the Help have to be displayed. bool ShowHelp = false; // Do the Help have to be displayed.
uint8 ShowInfos = 0; // 0=no info 1=text info 2=graph info uint8 ShowInfos = 0; // 0=no info 1=text info 2=graph info
bool bZeroCpu = 0; // For no Cpu use if application is minimize TODO: intercept minimize message, called by CTRL + Z at this bool bZeroCpu = false; // For no Cpu use if application is minimize TODO: intercept minimize message, called by CTRL + Z at this
bool Profiling = false; // Are we in Profile mode? bool Profiling = false; // Are we in Profile mode?
uint ProfileNumFrame = 0; uint ProfileNumFrame = 0;
@ -2287,8 +2287,11 @@ bool mainLoop()
smoothFPS.addValue((float)deltaTime); smoothFPS.addValue((float)deltaTime);
moreSmoothFPS.addValue((float)deltaTime); moreSmoothFPS.addValue((float)deltaTime);
deltaTime = smoothFPS.getSmoothValue (); deltaTime = smoothFPS.getSmoothValue ();
CCDBNodeLeaf*pNL = pIMinstance->getDbProp("UI:VARIABLES:FPS"); if (deltaTime > 0.0)
pNL->setValue64((sint64)(1.f/deltaTime)); {
CCDBNodeLeaf*pNL = pIMinstance->getDbProp("UI:VARIABLES:FPS");
pNL->setValue64((sint64)(1.f/deltaTime));
}
} }
// Detect disconnection / server down: display information text // Detect disconnection / server down: display information text