mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 10:09:41 +00:00
Discard old save game weather records
This commit is contained in:
parent
c907ed517d
commit
7817c52cbb
2 changed files with 31 additions and 20 deletions
|
@ -5,7 +5,9 @@
|
|||
|
||||
#include <components/misc/rng.hpp>
|
||||
|
||||
#include <components/esm/esmreader.hpp>
|
||||
#include <components/esm/esmwriter.hpp>
|
||||
#include <components/esm/savedgame.hpp>
|
||||
#include <components/esm/weatherstate.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)
|
||||
{
|
||||
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;
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "defs.hpp"
|
||||
|
||||
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE;
|
||||
int ESM::SavedGame::sCurrentFormat = 1;
|
||||
int ESM::SavedGame::sCurrentFormat = 2;
|
||||
|
||||
void ESM::SavedGame::load (ESMReader &esm)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue