From ebbd1e1280a6f31b0ff00c4cd9f2b8f02ce732e4 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Thu, 12 Apr 2012 18:06:33 +0200 Subject: [PATCH] Added: Log warnings when setting excessively high max distances on sound sources --- code/nel/src/sound/driver/openal/source_al.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/nel/src/sound/driver/openal/source_al.cpp b/code/nel/src/sound/driver/openal/source_al.cpp index c19f71639..b56276ec2 100644 --- a/code/nel/src/sound/driver/openal/source_al.cpp +++ b/code/nel/src/sound/driver/openal/source_al.cpp @@ -496,6 +496,14 @@ bool CSourceAL::getSourceRelativeMode() const void CSourceAL::setMinMaxDistances( float mindist, float maxdist, bool /* deferred */) { nlassert( (mindist >= 0.0f) && (maxdist >= 0.0f) ); + + static float maxSqrt = sqrt(std::numeric_limits::max()); + if (maxdist >= maxSqrt) + { + nlwarning("SOUND_DEV (OpenAL): Ridiculously high max distance set on source"); + maxdist = maxSqrt; + } + _MinDistance = mindist; _MaxDistance = maxdist; if (!_SoundDriver->getOption(ISoundDriver::OptionManualRolloff))