From b371588b93c2bda36c53ccb93454bf3ee39eb316 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 --HG-- branch : sound_dev --- 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))