Skip to content

Commit

Permalink
Correction to the e9844e1 commit.
Browse files Browse the repository at this point in the history
Restored interrior check in WeatherManager::update().

Signed-off-by: Lukasz Gromanowski <[email protected]>
  • Loading branch information
lgromanowski committed Jan 1, 2014
1 parent 101813f commit 722469d
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions apps/openmw/mwworld/weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "")
Expand Down Expand Up @@ -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;
}

// 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";
std::string regionstr = Misc::StringUtils::lowerCase(world->getPlayer().getPlayer().getCell()->mCell->mRegion);

if (mRegionOverrides.find(regionstr) != mRegionOverrides.end())
{
weatherType = mRegionOverrides[regionstr];
}
else
if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion)
{
// get weather probabilities for the current region
const ESM::Region *region = world->getStore().get<ESM::Region>().search (regionstr);
mCurrentRegion = regionstr;
mWeatherUpdateTime = mHoursBetweenWeatherChanges * 3600;

std::string weatherType = "clear";

if (region != 0)
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<ESM::Region>().search (regionstr);

if (region != 0)
{
weatherType = nextWeather(region);
}
}
}

setWeather(weatherType, instantly);
setWeather(weatherType, instantly);
}
}
}

0 comments on commit 722469d

Please sign in to comment.