Move weather reset to clear() method

openmw-35
scrawl 10 years ago
parent b1bd236345
commit 72f7c2e555

@ -770,14 +770,6 @@ bool WeatherManager::readRecord(ESM::ESMReader& reader, uint32_t type)
ESM::WeatherState state;
state.load(reader);
// reset other temporary state, now that we loaded successfully
stopSounds(); // let's hope this never throws
mRegionOverrides.clear();
mRegionMods.clear();
mThunderFlash = 0.0;
mThunderChance = 0.0;
mThunderChanceNeeded = 50.0;
// swap in the loaded values now that we can't fail
mHour = state.mHour;
mWindSpeed = state.mWindSpeed;
@ -794,6 +786,16 @@ bool WeatherManager::readRecord(ESM::ESMReader& reader, uint32_t type)
return false;
}
void WeatherManager::clear()
{
stopSounds();
mRegionOverrides.clear();
mRegionMods.clear();
mThunderFlash = 0.0;
mThunderChance = 0.0;
mThunderChanceNeeded = 50.0;
}
void WeatherManager::switchToNextWeather(bool instantly)
{
MWBase::World* world = MWBase::Environment::get().getWorld();

@ -201,6 +201,8 @@ namespace MWWorld
bool readRecord(ESM::ESMReader& reader, uint32_t type);
void clear();
private:
float mHour;
float mWindSpeed;

@ -265,6 +265,7 @@ namespace MWWorld
void World::clear()
{
mWeatherManager->clear();
mRendering->clear();
mProjectileManager->clear();

Loading…
Cancel
Save