WeatherManager: fix for cells that have no region.

This commit is contained in:
scrawl 2012-05-17 18:21:05 +02:00
parent 0afda15ce9
commit 375c198ebd

View file

@ -499,15 +499,17 @@ void WeatherManager::update(float duration)
mCurrentRegion = regionstr;
mWeatherUpdateTime = WeatherGlobals::mWeatherUpdateTime*3600;
std::string weather;
std::string weather = "clear";
if (mRegionOverrides.find(regionstr) != mRegionOverrides.end())
weather = mRegionOverrides[regionstr];
else
{
// get weather probabilities for the current region
const ESM::Region *region = MWBase::Environment::get().getWorld()->getStore().regions.find (regionstr);
const ESM::Region *region = MWBase::Environment::get().getWorld()->getStore().regions.search (regionstr);
if (region != 0)
{
float clear = region->data.clear/255.f;
float cloudy = region->data.cloudy/255.f;
float foggy = region->data.foggy/255.f;
@ -545,6 +547,7 @@ void WeatherManager::update(float duration)
else
weather = "clear";
}
}
setWeather(weather, false);
}