From f729686539b4e4628ab818e1a2bffbe1d48ed114 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Thu, 28 Feb 2013 22:56:44 +0100 Subject: Fixed segfault in light manager Also fixed minor memory leak --- src/graphics/engine/lightman.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/graphics') diff --git a/src/graphics/engine/lightman.cpp b/src/graphics/engine/lightman.cpp index eae622b..16c84ea 100644 --- a/src/graphics/engine/lightman.cpp +++ b/src/graphics/engine/lightman.cpp @@ -389,7 +389,8 @@ void CLightManager::UpdateDeviceLights(EngineObjectType type) m_lightMap[i] = -1; std::vector sortedLights = m_dynLights; - std::sort(sortedLights.begin(), sortedLights.end(), LightsComparator(m_engine->GetEyePt(), type)); + LightsComparator lightsComparator(m_engine->GetEyePt(), type); + std::sort(sortedLights.begin(), sortedLights.end(), lightsComparator); int lightMapIndex = 0; for (int i = 0; i < static_cast( sortedLights.size() ); i++) @@ -460,7 +461,7 @@ bool CLightManager::LightsComparator::operator()(const DynamicLight& left, const float leftWeight = GetLightWeight(left); float rightWeight = GetLightWeight(right); - return leftWeight <= rightWeight; + return leftWeight < rightWeight; } } // namespace Gfx -- cgit v1.2.3-1-g7c22