From 0f94026dfe637cfe127daff5fb10cfb16dca2a92 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 5 Jun 2010 10:50:04 +0200 Subject: [PATCH] Fixed: #963 Floating point exceptions --- code/nel/src/sound/driver/source.cpp | 5 ++++- code/ryzom/client/src/main_loop.cpp | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/code/nel/src/sound/driver/source.cpp b/code/nel/src/sound/driver/source.cpp index 7c422b701..0a2090d29 100644 --- a/code/nel/src/sound/driver/source.cpp +++ b/code/nel/src/sound/driver/source.cpp @@ -25,12 +25,15 @@ namespace NLSOUND // 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) { + // root square of max float value + static float maxSqrt = sqrt(std::numeric_limits::max()); + if (sqrdist < distMin * distMin) { // no attenuation return volumeMB; } - else if (sqrdist > distMax * distMax) + else if ((distMax < maxSqrt) && (sqrdist > distMax * distMax)) { // full attenuation return mbMin; diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 4ebb7ad9b..7c9084b95 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -322,7 +322,7 @@ std::string DebugUIFilter; bool ShowHelp = false; // Do the Help have to be displayed. 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? uint ProfileNumFrame = 0; @@ -2287,8 +2287,11 @@ bool mainLoop() smoothFPS.addValue((float)deltaTime); moreSmoothFPS.addValue((float)deltaTime); deltaTime = smoothFPS.getSmoothValue (); - CCDBNodeLeaf*pNL = pIMinstance->getDbProp("UI:VARIABLES:FPS"); - pNL->setValue64((sint64)(1.f/deltaTime)); + if (deltaTime > 0.0) + { + CCDBNodeLeaf*pNL = pIMinstance->getDbProp("UI:VARIABLES:FPS"); + pNL->setValue64((sint64)(1.f/deltaTime)); + } } // Detect disconnection / server down: display information text