Moved quickload to statemanager for consistency's sake, as well as make autosave only occur on sleep, not wait.

actorid
Thomas 11 years ago
parent 05b21c92af
commit 5b681e2199

@ -69,6 +69,10 @@ namespace MWBase
/** Used for quick save and autosave **/
virtual void quickSave(std::string = "Quicksave")=0;
///Simple loader, loads the last saved file
/** Used for quickload **/
virtual void quickLoad()=0;
virtual MWState::Character *getCurrentCharacter (bool create = true) = 0;
///< \param create Create a new character, if there is no current character.

@ -121,7 +121,7 @@ namespace MWGui
MWBase::World* world = MWBase::Environment::get().getWorld();
world->getFader ()->fadeOut(0.2);
setVisible(false);
if(Settings::Manager::getBool("autosave","Saves")) //autosaves
if(Settings::Manager::getBool("autosave","Saves") && mSleeping) //autosaves when enabled and sleeping (Not resting, apparently)
MWBase::Environment::get().getStateManager()->quickSave("Autosave");
mProgressBar.setVisible (true);

@ -646,14 +646,7 @@ namespace MWInput
}
void InputManager::quickLoad() {
if(MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1) {
MWState::Character* mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter(false); //Get current character
if(mCurrentCharacter) { //Ensure a current character exists
const MWState::Slot* slot = &*mCurrentCharacter->begin(); //Get newest save
if(slot) //Don't even try loading it if there's no prior save.
MWBase::Environment::get().getStateManager()->loadGame (mCurrentCharacter, slot); //load newest save. That was easy!
}
}
MWBase::Environment::get().getStateManager()->quickLoad();
}
void InputManager::quickSave() {

@ -345,6 +345,17 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
}
}
void MWState::StateManager::quickLoad() {
if(MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1) {
MWState::Character* mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter(false); //Get current character
if(mCurrentCharacter) { //Ensure a current character exists
const MWState::Slot* slot = &*mCurrentCharacter->begin(); //Get newest save
if(slot) //Don't even try loading it if there's no prior save.
MWBase::Environment::get().getStateManager()->loadGame (mCurrentCharacter, slot); //load newest save. That was easy!
}
}
}
MWState::Character *MWState::StateManager::getCurrentCharacter (bool create)
{
return mCharacterManager.getCurrentCharacter (create);

@ -50,9 +50,14 @@ namespace MWState
/// \note Slot must belong to the current character.
///Saves a file, using supplied filename, overwritting if needed
/** This is mostly used for quicksaving and autosaving, for they use the same name over and over again **/
/** This is mostly used for quicksaving and autosaving, for they use the same name over and over again
\param name Name of save, defaults to "Quicksave"**/
virtual void quickSave(std::string name = "Quicksave");
///Loads the last saved file
/** Used for quickload **/
virtual void quickLoad();
virtual void loadGame (const Character *character, const Slot *slot);
///< Load a saved game file from \a slot.
///

Loading…
Cancel
Save