Refuse loading save games of unknown format

c++11
scrawl 10 years ago
parent a081d402c5
commit 20d03c7e39

@ -29,9 +29,6 @@ void MWState::Character::addSlot (const boost::filesystem::path& path, const std
ESM::ESMReader reader;
reader.open (slot.mPath.string());
if (reader.getFormat()>ESM::Header::CurrentFormat)
return; // format is too new -> ignore
if (reader.getRecName()!=ESM::REC_SAVE)
return; // invalid save file -> ignore

@ -325,8 +325,6 @@ void MWState::StateManager::loadGame(const std::string& filepath)
// have to peek into the save file to get the player name
ESM::ESMReader reader;
reader.open (filepath);
if (reader.getFormat()>ESM::Header::CurrentFormat)
return; // format is too new -> ignore
if (reader.getRecName()!=ESM::REC_SAVE)
return; // invalid save file -> ignore
reader.getRecHeader();
@ -348,6 +346,9 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
ESM::ESMReader reader;
reader.open (filepath);
if (reader.getFormat() > ESM::SavedGame::sCurrentFormat)
throw std::runtime_error("This save file was created using a newer version of OpenMW and is thus not supported. Please upgrade to the newest OpenMW version to load this file.");
std::map<int, int> contentFileMap = buildContentFileIndexMap (reader);
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();

Loading…
Cancel
Save