From bd1f3493d76cf2ab3b2b5ca2dc1e90c062e6ca38 Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 2 Nov 2015 21:35:03 +0100 Subject: [PATCH] Fix weather particles not being cleared when changing from one particle effect to another --- apps/openmw/mwrender/sky.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index b0af85c0b6..240dff7fd1 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -1432,6 +1432,14 @@ void SkyManager::setWeather(const WeatherResult& weather) { mCurrentParticleEffect = weather.mParticleEffect; + // cleanup old particles + if (mParticleEffect) + { + mParticleNode->removeChild(mParticleEffect); + mParticleEffect = NULL; + mParticleFader = NULL; + } + if (mCurrentParticleEffect.empty()) { if (mParticleNode) @@ -1439,8 +1447,6 @@ void SkyManager::setWeather(const WeatherResult& weather) mRootNode->removeChild(mParticleNode); mParticleNode = NULL; } - mParticleEffect = NULL; - mParticleFader = NULL; } else {