Discard old save game weather records

sceneinput
slothlife 9 years ago
parent c907ed517d
commit 7817c52cbb

@ -5,7 +5,9 @@
#include <components/misc/rng.hpp> #include <components/misc/rng.hpp>
#include <components/esm/esmreader.hpp>
#include <components/esm/esmwriter.hpp> #include <components/esm/esmwriter.hpp>
#include <components/esm/savedgame.hpp>
#include <components/esm/weatherstate.hpp> #include <components/esm/weatherstate.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -722,6 +724,14 @@ void WeatherManager::write(ESM::ESMWriter& writer, Loading::Listener& progress)
bool WeatherManager::readRecord(ESM::ESMReader& reader, uint32_t type) bool WeatherManager::readRecord(ESM::ESMReader& reader, uint32_t type)
{ {
if(ESM::REC_WTHR == type) if(ESM::REC_WTHR == type)
{
if(reader.getFormat() < ESM::SavedGame::sCurrentFormat)
{
// Weather state isn't really all that important, so to preserve older save games, we'll just discard the
// older weather records, rather than fail to handle the record.
reader.skipRecord();
}
else
{ {
ESM::WeatherState state; ESM::WeatherState state;
state.load(reader); state.load(reader);
@ -749,6 +759,7 @@ bool WeatherManager::readRecord(ESM::ESMReader& reader, uint32_t type)
mRegions.insert(std::make_pair(it->first, RegionWeather(it->second))); mRegions.insert(std::make_pair(it->first, RegionWeather(it->second)));
} }
} }
}
return true; return true;
} }

@ -5,7 +5,7 @@
#include "defs.hpp" #include "defs.hpp"
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE; unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE;
int ESM::SavedGame::sCurrentFormat = 1; int ESM::SavedGame::sCurrentFormat = 2;
void ESM::SavedGame::load (ESMReader &esm) void ESM::SavedGame::load (ESMReader &esm)
{ {

Loading…
Cancel
Save