forked from mirror/openmw-tes3mp
Added autosave on rest, as well as an option in the settings menu
This commit is contained in:
parent
682c395488
commit
a598060071
5 changed files with 40 additions and 8 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/statemanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
@ -15,6 +16,7 @@
|
|||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "../mwstate/charactermanager.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
@ -236,6 +238,25 @@ namespace MWGui
|
|||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode (GM_Levelup);
|
||||
}
|
||||
if(Settings::Manager::getBool("autosave","Saves"))
|
||||
autosave();
|
||||
}
|
||||
|
||||
void WaitDialog::autosave() {
|
||||
if(MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1) { //ensure you're not in character creation
|
||||
const MWState::Slot* slot = NULL;
|
||||
MWState::Character* mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter(true); //Get current character
|
||||
if (mCurrentCharacter) //Ensure one exists
|
||||
{
|
||||
//Find quicksave slot
|
||||
for (MWState::Character::SlotIterator it = mCurrentCharacter->begin(); it != mCurrentCharacter->end(); ++it)
|
||||
{
|
||||
if (it->mProfile.mDescription == "Autosave")
|
||||
slot = &*it;
|
||||
}
|
||||
MWBase::Environment::get().getStateManager()->saveGame("Autosave", slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WaitDialog::wakeUp ()
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace MWGui
|
|||
|
||||
bool getSleeping() { return mWaiting && mSleeping; }
|
||||
void wakeUp();
|
||||
void autosave();
|
||||
|
||||
protected:
|
||||
MyGUI::TextBox* mDateTimeText;
|
||||
|
|
|
@ -659,7 +659,7 @@ namespace MWInput
|
|||
void InputManager::quickSave() {
|
||||
if(MWBase::Environment::get().getWorld()->getGlobalInt ("chargenstate")==-1) { //ensure you're not in character creation
|
||||
const MWState::Slot* slot = NULL;
|
||||
MWState::Character* mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter(false); //Get current character
|
||||
MWState::Character* mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter(true); //Get current character
|
||||
if (mCurrentCharacter) //Ensure one exists
|
||||
{
|
||||
//Find quicksave slot
|
||||
|
@ -668,10 +668,6 @@ namespace MWInput
|
|||
if (it->mProfile.mDescription == "Quicksave")
|
||||
slot = &*it;
|
||||
}
|
||||
//If no quicksave works create a new slot with Signature
|
||||
if(slot == NULL) {
|
||||
slot = mCurrentCharacter->createSlot(mCurrentCharacter->getSignature());
|
||||
}
|
||||
//MWBase::Environment::get().getWindowManager()->messageBox("#{sQuick_save}"); //No message on quicksave?
|
||||
MWBase::Environment::get().getStateManager()->saveGame("Quicksave", slot);
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<MyGUI type="Layout">
|
||||
<Widget type="Window" skin="MW_Window_NoCaption" layer="Windows" position="0 0 400 426" name="_Main">
|
||||
|
||||
<Property key="MinSize" value="400 426"/>
|
||||
<Property key="MaxSize" value="400 426"/>
|
||||
<Property key="MinSize" value="400 496"/>
|
||||
<Property key="MaxSize" value="400 496"/>
|
||||
|
||||
<Widget type="TabControl" skin="TabControl" position="8 8 368 340" align="Left Top" name="SettingsTab">
|
||||
<Widget type="TabControl" skin="TabControl" position="8 8 368 410" align="Left Top" name="SettingsTab">
|
||||
<Property key="ButtonAutoWidth" value="true"/>
|
||||
|
||||
<Widget type="TabItem" skin="" position="4 28 360 312">
|
||||
|
@ -95,6 +95,18 @@
|
|||
<Property key="Caption" value="Grab cursor"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
<Widget type="HBox" skin="" position="4 290 260 24">
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" align="Left Top" name="AutosaveButton">
|
||||
<UserString key="SettingCategory" value="Saves"/>
|
||||
<UserString key="SettingName" value="autosave"/>
|
||||
<UserString key="SettingType" value="CheckButton"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" align="Left Top">
|
||||
<Property key="Caption" value="#{sQuick_Save}"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
|
||||
</Widget>
|
||||
<Widget type="TabItem" skin="" position="4 28 360 312">
|
||||
<Property key="Caption" value=" #{sAudio} "/>
|
||||
|
|
|
@ -174,6 +174,8 @@ best attack = false
|
|||
|
||||
[Saves]
|
||||
character =
|
||||
# Save when resting
|
||||
autosave = true
|
||||
|
||||
[Windows]
|
||||
inventory x = 0
|
||||
|
|
Loading…
Reference in a new issue