diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2013-02-28 22:56:44 +0100 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2013-02-28 22:56:44 +0100 |
commit | f729686539b4e4628ab818e1a2bffbe1d48ed114 (patch) | |
tree | 27c1ce84f2584140da019201929958a8f4bd1bf1 /src/graphics/engine/lightman.cpp | |
parent | 08c646bb929c7bc98b005521b6e0c14428f651d0 (diff) | |
download | colobot-f729686539b4e4628ab818e1a2bffbe1d48ed114.tar.gz colobot-f729686539b4e4628ab818e1a2bffbe1d48ed114.tar.bz2 colobot-f729686539b4e4628ab818e1a2bffbe1d48ed114.zip |
Fixed segfault in light manager
Also fixed minor memory leak
Diffstat (limited to 'src/graphics/engine/lightman.cpp')
-rw-r--r-- | src/graphics/engine/lightman.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<DynamicLight> 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<int>( 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 |