diff options
author | Alexander Tkachev | 2016-06-07 20:40:19 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | f6e69b62765482d290b7673e97fb7cf6a03fc943 (patch) | |
tree | 8d86b9b63d26e0fbb47e7c89784b7e13c83c940a /backends/saves/default | |
parent | 62a640ff440919ae762072a6e6acea415f0957dd (diff) | |
download | scummvm-rg350-f6e69b62765482d290b7673e97fb7cf6a03fc943.tar.gz scummvm-rg350-f6e69b62765482d290b7673e97fb7cf6a03fc943.tar.bz2 scummvm-rg350-f6e69b62765482d290b7673e97fb7cf6a03fc943.zip |
CLOUD: Fix DefaultSaveFileManager again
Now openForLoading() and openForSaving() check whether file is locked,
so AGOS and SCUMM engines Ctrl+number and Alt+number hot keys shouldn't
be able to save/load in these slots during saves sync.
Diffstat (limited to 'backends/saves/default')
-rw-r--r-- | backends/saves/default/default-saves.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index a669c2ce81..3fcb3cb3b3 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -27,6 +27,10 @@ #include "common/scummsys.h" +#ifdef USE_CLOUD +#include "backends/cloud/cloudmanager.h" +#endif + #if !defined(DISABLE_DEFAULT_SAVEFILEMANAGER) #include "backends/saves/default/default-saves.h" @@ -109,6 +113,12 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String if (getError().getCode() != Common::kNoError) return nullptr; + for (Common::StringArray::const_iterator i = _lockedFiles.begin(), end = _lockedFiles.end(); i != end; ++i) { + if (filename == *i) { + return nullptr; //file is locked, no loading available + } + } + SaveFileCache::const_iterator file = _saveFileCache.find(filename); if (file == _saveFileCache.end()) { return nullptr; @@ -126,6 +136,12 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String if (getError().getCode() != Common::kNoError) return nullptr; + for (Common::StringArray::const_iterator i = _lockedFiles.begin(), end = _lockedFiles.end(); i != end; ++i) { + if (filename == *i) { + return nullptr; //file is locked, no saving available + } + } + // Obtain node. SaveFileCache::const_iterator file = _saveFileCache.find(filename); Common::FSNode fileNode; @@ -209,6 +225,12 @@ void DefaultSaveFileManager::assureCached(const Common::String &savePathName) { // Check that path exists and is usable. checkPath(Common::FSNode(savePathName)); +#ifdef USE_CLOUD + Common::Array<Common::String> files = CloudMan.getSyncingFiles(); //returns empty array if not syncing + if (!files.empty()) updateSavefilesList(files); //makes this cache invalid + else _lockedFiles = files; +#endif + if (_cachedDirectory == savePathName) { return; } |