From 722469d57b12fe48c83cdbd40c128720278163e5 Mon Sep 17 00:00:00 2001 From: Lukasz Gromanowski Date: Wed, 1 Jan 2014 16:45:39 +0100 Subject: [PATCH] Correction to the e9844e1 commit. Restored interrior check in WeatherManager::update(). Signed-off-by: Lukasz Gromanowski --- apps/openmw/mwworld/weather.cpp | 61 +++++++++++++++++---------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 124fc14ab2..06c2e2a36c 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -324,6 +324,17 @@ void WeatherManager::update(float duration) mWeatherUpdateTime -= timePassed; + MWBase::World* world = MWBase::Environment::get().getWorld(); + const bool exterior = (world->isCellExterior() || world->isCellQuasiExterior()); + if (!exterior) + { + mRendering->sunDisable(false); + mRendering->skyDisable(); + mRendering->getSkyManager()->setLightningStrength(0.f); + stopSounds(true); + return; + } + switchToNextWeather(false); if (mNextWeather != "") @@ -676,41 +687,33 @@ float WeatherManager::getWindSpeed() const void WeatherManager::switchToNextWeather(bool instantly) { MWBase::World* world = MWBase::Environment::get().getWorld(); - const bool exterior = (world->isCellExterior() || world->isCellQuasiExterior()); - if (!exterior) + if (world->isCellExterior() || world->isCellQuasiExterior()) { - mRendering->sunDisable(false); - mRendering->skyDisable(); - mRendering->getSkyManager()->setLightningStrength(0.f); - stopSounds(true); - return; - } + std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayer().getPlayer().getCell()->mCell->mRegion); - // Exterior - std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayer().getPlayer().getCell()->mCell->mRegion); - - if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion) - { - mCurrentRegion = regionstr; - mWeatherUpdateTime = mHoursBetweenWeatherChanges * 3600; - - std::string weatherType = "clear"; - - if (mRegionOverrides.find(regionstr) != mRegionOverrides.end()) + if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion) { - weatherType = mRegionOverrides[regionstr]; - } - else - { - // get weather probabilities for the current region - const ESM::Region *region = world->getStore().get().search (regionstr); + mCurrentRegion = regionstr; + mWeatherUpdateTime = mHoursBetweenWeatherChanges * 3600; - if (region != 0) + std::string weatherType = "clear"; + + if (mRegionOverrides.find(regionstr) != mRegionOverrides.end()) { - weatherType = nextWeather(region); + weatherType = mRegionOverrides[regionstr]; } - } + else + { + // get weather probabilities for the current region + const ESM::Region *region = world->getStore().get().search (regionstr); - setWeather(weatherType, instantly); + if (region != 0) + { + weatherType = nextWeather(region); + } + } + + setWeather(weatherType, instantly); + } } }