From 7b59eda13a904ec3fa6630f40cc48f5ad02973c6 Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sat, 15 Oct 2016 17:34:03 +0200 Subject: [PATCH] Import base weather states before loading region modifiers (Fixes #3594) --- apps/openmw/mwworld/weather.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 46991c440..7111edd7d 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -832,17 +832,14 @@ bool WeatherManager::readRecord(ESM::ESMReader& reader, uint32_t type) mQueuedWeather = state.mQueuedWeather; mRegions.clear(); - std::map::iterator it = state.mRegions.begin(); - if(it == state.mRegions.end()) + importRegions(); + + for(std::map::iterator it = state.mRegions.begin(); it != state.mRegions.end(); ++it) { - // When loading an imported save, the region modifiers aren't currently being set, so just reset them. - importRegions(); - } - else - { - for(; it != state.mRegions.end(); ++it) + std::map::iterator found = mRegions.find(it->first); + if (found != mRegions.end()) { - mRegions.insert(std::make_pair(it->first, RegionWeather(it->second))); + found->second = RegionWeather(it->second); } } }