forked from mirror/openmw-tes3mp
Don't create the save directory on loading a game
This prevents empty directories being created when loading a save file outside of the saves directory with the --load-savegame switch.
This commit is contained in:
parent
d7c7bb850b
commit
426a6fdcc2
3 changed files with 11 additions and 22 deletions
|
@ -101,15 +101,16 @@ std::list<MWState::Character>::iterator MWState::CharacterManager::findCharacter
|
|||
|
||||
void MWState::CharacterManager::setCurrentCharacter (const Character *character)
|
||||
{
|
||||
std::list<Character>::iterator it = findCharacter(character);
|
||||
if (!character)
|
||||
mCurrent = NULL;
|
||||
else
|
||||
{
|
||||
std::list<Character>::iterator it = findCharacter(character);
|
||||
|
||||
mCurrent = &*it;
|
||||
mCurrent = &*it;
|
||||
}
|
||||
}
|
||||
|
||||
void MWState::CharacterManager::clearCurrentCharacter()
|
||||
{
|
||||
mCurrent = 0;
|
||||
}
|
||||
|
||||
std::list<MWState::Character>::const_iterator MWState::CharacterManager::begin() const
|
||||
{
|
||||
|
|
|
@ -43,8 +43,6 @@ namespace MWState
|
|||
|
||||
void setCurrentCharacter (const Character *character);
|
||||
|
||||
void clearCurrentCharacter();
|
||||
|
||||
std::list<Character>::const_iterator begin() const;
|
||||
|
||||
std::list<Character>::const_iterator end() const;
|
||||
|
|
|
@ -54,7 +54,7 @@ void MWState::StateManager::cleanup (bool force)
|
|||
MWBase::Environment::get().getMechanicsManager()->clear();
|
||||
|
||||
mState = State_NoGame;
|
||||
mCharacterManager.clearCurrentCharacter();
|
||||
mCharacterManager.setCurrentCharacter(NULL);
|
||||
mTimePlayed = 0;
|
||||
|
||||
MWMechanics::CreatureStats::cleanup();
|
||||
|
@ -333,19 +333,8 @@ 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.getRecName()!=ESM::REC_SAVE)
|
||||
return; // invalid save file -> ignore
|
||||
reader.getRecHeader();
|
||||
ESM::SavedGame profile;
|
||||
profile.load (reader);
|
||||
reader.close();
|
||||
|
||||
MWState::Character* character = mCharacterManager.getCurrentCharacter(true, profile.mPlayerName);
|
||||
MWState::Character* character = getCurrentCharacter(false);
|
||||
loadGame(character, filepath);
|
||||
mTimePlayed = profile.mTimePlayed;
|
||||
}
|
||||
|
||||
void MWState::StateManager::loadGame (const Character *character, const std::string& filepath)
|
||||
|
@ -470,7 +459,8 @@ void MWState::StateManager::loadGame (const Character *character, const std::str
|
|||
|
||||
mState = State_Running;
|
||||
|
||||
Settings::Manager::setString ("character", "Saves",
|
||||
if (character)
|
||||
Settings::Manager::setString ("character", "Saves",
|
||||
character->getPath().filename().string());
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->setNewGame(false);
|
||||
|
|
Loading…
Reference in a new issue