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; ESM::WeatherState state;
state.load(reader); 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 // swap in the loaded values now that we can't fail
mHour = state.mHour; mHour = state.mHour;
mWindSpeed = state.mWindSpeed; mWindSpeed = state.mWindSpeed;
@ -794,6 +786,16 @@ bool WeatherManager::readRecord(ESM::ESMReader& reader, uint32_t type)
return false; return false;
} }
void WeatherManager::clear()
{
stopSounds();
mRegionOverrides.clear();
mRegionMods.clear();
mThunderFlash = 0.0;
mThunderChance = 0.0;
mThunderChanceNeeded = 50.0;
}
void WeatherManager::switchToNextWeather(bool instantly) void WeatherManager::switchToNextWeather(bool instantly)
{ {
MWBase::World* world = MWBase::Environment::get().getWorld(); MWBase::World* world = MWBase::Environment::get().getWorld();

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

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

Loading…
Cancel
Save