forked from teamnwah/openmw-tes3coop
restore last played character selection across sessions
This commit is contained in:
parent
b40c0f2a07
commit
eea433f141
3 changed files with 23 additions and 4 deletions
|
@ -1,10 +1,13 @@
|
|||
#include "savegamedialog.hpp"
|
||||
#include "widgets.hpp"
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwbase/statemanager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
||||
|
||||
#include "../mwstate/character.hpp"
|
||||
|
||||
namespace
|
||||
|
@ -93,6 +96,9 @@ namespace MWGui
|
|||
|
||||
mCurrentCharacter = mgr->getCurrentCharacter (false);
|
||||
|
||||
std::string directory =
|
||||
Misc::StringUtils::lowerCase (Settings::Manager::getString ("character", "Saves"));
|
||||
|
||||
mCharacterSelection->removeAllItems();
|
||||
|
||||
for (MWBase::StateManager::CharacterIterator it = mgr->characterBegin(); it != mgr->characterEnd(); ++it)
|
||||
|
@ -105,7 +111,9 @@ namespace MWGui
|
|||
|
||||
mCharacterSelection->addItem (title.str());
|
||||
|
||||
if (mCurrentCharacter == &*it)
|
||||
if (mCurrentCharacter == &*it ||
|
||||
(!mCurrentCharacter && directory==Misc::StringUtils::lowerCase (
|
||||
it->begin()->mPath.parent_path().filename().string())))
|
||||
mCharacterSelection->setIndexSelected(mCharacterSelection->getItemCount()-1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <components/esm/esmwriter.hpp>
|
||||
#include <components/esm/esmreader.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/journal.hpp"
|
||||
|
@ -114,6 +116,9 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
|
|||
slot->mProfile.save (writer);
|
||||
writer.endRecord ("SAVE");
|
||||
writer.close();
|
||||
|
||||
Settings::Manager::setString ("character", "Saves",
|
||||
slot->mPath.parent_path().filename().string());
|
||||
}
|
||||
|
||||
void MWState::StateManager::loadGame (const Character *character, const Slot *slot)
|
||||
|
@ -137,6 +142,9 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
|
|||
mCharacterManager.setCurrentCharacter(character);
|
||||
|
||||
mState = State_Running;
|
||||
|
||||
Settings::Manager::setString ("character", "Saves",
|
||||
slot->mPath.parent_path().filename().string());
|
||||
}
|
||||
|
||||
MWState::Character *MWState::StateManager::getCurrentCharacter (bool create)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# WARNING: Editing this file might have no effect, as these
|
||||
# WARNING: Editing this file might have no effect, as these
|
||||
# settings are overwritten by your user settings file.
|
||||
|
||||
[Video]
|
||||
|
@ -13,7 +13,7 @@ screen = 0
|
|||
# Valid values:
|
||||
# OpenGL Rendering Subsystem
|
||||
# Direct3D9 Rendering Subsystem
|
||||
render system =
|
||||
render system =
|
||||
|
||||
# Valid values:
|
||||
# none
|
||||
|
@ -169,3 +169,6 @@ ui y multiplier = 1.0
|
|||
[Game]
|
||||
# Always use the most powerful attack when striking with a weapon (chop, slash or thrust)
|
||||
best attack = false
|
||||
|
||||
[Saves]
|
||||
character =
|
Loading…
Reference in a new issue