Use settings values for Saves settings

macos_ci_fix
elsid 1 year ago
parent f5ddf55cdc
commit 1038a68fbf
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -17,7 +17,7 @@
#include <components/misc/strings/lower.hpp> #include <components/misc/strings/lower.hpp>
#include <components/settings/settings.hpp> #include <components/settings/values.hpp>
#include <components/files/conversion.hpp> #include <components/files/conversion.hpp>
#include <components/files/memorystream.hpp> #include <components/files/memorystream.hpp>
@ -168,7 +168,7 @@ namespace MWGui
mCurrentCharacter = mgr->getCurrentCharacter(); mCurrentCharacter = mgr->getCurrentCharacter();
const std::string& directory = Settings::Manager::getString("character", "Saves"); const std::string& directory = Settings::saves().mCharacter;
size_t selectedIndex = MyGUI::ITEM_NONE; size_t selectedIndex = MyGUI::ITEM_NONE;
@ -427,7 +427,7 @@ namespace MWGui
mCurrentSlot->mProfile.mInGameTime.mMonth) mCurrentSlot->mProfile.mInGameTime.mMonth)
<< " " << hour << " " << (pm ? "#{Calendar:pm}" : "#{Calendar:am}"); << " " << hour << " " << (pm ? "#{Calendar:pm}" : "#{Calendar:am}");
if (Settings::Manager::getBool("timeplayed", "Saves")) if (Settings::saves().mTimeplayed)
{ {
text << "\n" text << "\n"
<< "#{OMWEngine:TimePlayed}: " << formatTimeplayed(mCurrentSlot->mProfile.mTimePlayed); << "#{OMWEngine:TimePlayed}: " << formatTimeplayed(mCurrentSlot->mProfile.mTimePlayed);

@ -186,7 +186,7 @@ namespace MWGui
void WaitDialog::startWaiting(int hoursToWait) void WaitDialog::startWaiting(int hoursToWait)
{ {
if (Settings::Manager::getBool("autosave", "Saves")) // autosaves when enabled if (Settings::saves().mAutosave) // autosaves when enabled
MWBase::Environment::get().getStateManager()->quickSave("Autosave"); MWBase::Environment::get().getStateManager()->quickSave("Autosave");
MWBase::World* world = MWBase::Environment::get().getWorld(); MWBase::World* world = MWBase::Environment::get().getWorld();

@ -14,7 +14,7 @@
#include <components/loadinglistener/loadinglistener.hpp> #include <components/loadinglistener/loadinglistener.hpp>
#include <components/files/conversion.hpp> #include <components/files/conversion.hpp>
#include <components/settings/settings.hpp> #include <components/settings/values.hpp>
#include <osg/Image> #include <osg/Image>
@ -314,8 +314,7 @@ void MWState::StateManager::saveGame(std::string_view description, const Slot* s
if (filestream.fail()) if (filestream.fail())
throw std::runtime_error("Write operation failed (file stream)"); throw std::runtime_error("Write operation failed (file stream)");
Settings::Manager::setString( Settings::saves().mCharacter.set(Files::pathToUnicodeString(slot->mPath.parent_path().filename()));
"character", "Saves", Files::pathToUnicodeString(slot->mPath.parent_path().filename()));
const auto finish = std::chrono::steady_clock::now(); const auto finish = std::chrono::steady_clock::now();
@ -354,12 +353,8 @@ void MWState::StateManager::quickSave(std::string name)
return; return;
} }
int maxSaves = Settings::Manager::getInt("max quicksaves", "Saves");
if (maxSaves < 1)
maxSaves = 1;
Character* currentCharacter = getCurrentCharacter(); // Get current character Character* currentCharacter = getCurrentCharacter(); // Get current character
QuickSaveManager saveFinder = QuickSaveManager(name, maxSaves); QuickSaveManager saveFinder(name, Settings::saves().mMaxQuicksaves);
if (currentCharacter) if (currentCharacter)
{ {
@ -542,8 +537,7 @@ void MWState::StateManager::loadGame(const Character* character, const std::file
mState = State_Running; mState = State_Running;
if (character) if (character)
Settings::Manager::setString( Settings::saves().mCharacter.set(Files::pathToUnicodeString(character->getPath().filename()));
"character", "Saves", Files::pathToUnicodeString(character->getPath().filename()));
MWBase::Environment::get().getWindowManager()->setNewGame(false); MWBase::Environment::get().getWindowManager()->setNewGame(false);
MWBase::Environment::get().getWorld()->saveLoaded(); MWBase::Environment::get().getWorld()->saveLoaded();

Loading…
Cancel
Save