diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/cloud/savessyncrequest.cpp | 4 | ||||
-rw-r--r-- | backends/saves/default/default-saves.cpp | 20 | ||||
-rw-r--r-- | backends/saves/default/default-saves.h | 7 |
3 files changed, 26 insertions, 5 deletions
diff --git a/backends/cloud/savessyncrequest.cpp b/backends/cloud/savessyncrequest.cpp index 072685773e..d983a0fcae 100644 --- a/backends/cloud/savessyncrequest.cpp +++ b/backends/cloud/savessyncrequest.cpp @@ -214,11 +214,11 @@ void SavesSyncRequest::downloadNextFile() { return; } - sendCommand(kSavesSyncProgressCmd, (int)(getDownloadingProgress() * 100)); - _currentDownloadingFile = _filesToDownload.back(); _filesToDownload.pop_back(); + sendCommand(kSavesSyncProgressCmd, (int)(getDownloadingProgress() * 100)); + /////// debug("downloading %s (%d %%)", _currentDownloadingFile.name().c_str(), (int)(getProgress() * 100)); /////// diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 75ba50a081..a11d687c16 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -59,19 +59,33 @@ void DefaultSaveFileManager::checkPath(const Common::FSNode &dir) { } } +void DefaultSaveFileManager::updateSavefilesList(Common::StringArray &lockedFiles) { + //make it refresh the cache next time it lists the saves + _cachedDirectory = ""; + + //remember the locked files list because some of these files don't exist yet + _lockedFiles = lockedFiles; +} + Common::StringArray DefaultSaveFileManager::listSavefiles(const Common::String &pattern) { // Assure the savefile name cache is up-to-date. assureCached(getSavePath()); if (getError().getCode() != Common::kNoError) return Common::StringArray(); + Common::HashMap<Common::String, bool> locked; + for (Common::StringArray::const_iterator i = _lockedFiles.begin(), end = _lockedFiles.end(); i != end; ++i) { + if (i->matchString(pattern, true)) { + locked[*i] = true; + } + } + Common::StringArray results; - for (SaveFileCache::const_iterator file = _saveFileCache.begin(), end = _saveFileCache.end(); file != end; ++file) { - if (file->_key.matchString(pattern, true)) { + for (SaveFileCache::const_iterator file = _saveFileCache.begin(), end = _saveFileCache.end(); file != end; ++file) { + if (!locked.contains(file->_key) && file->_key.matchString(pattern, true)) { results.push_back(file->_key); } } - return results; } diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h index 166e7004ed..af30cf45e9 100644 --- a/backends/saves/default/default-saves.h +++ b/backends/saves/default/default-saves.h @@ -37,6 +37,7 @@ public: DefaultSaveFileManager(); DefaultSaveFileManager(const Common::String &defaultSavepath); + virtual void updateSavefilesList(Common::StringArray &lockedFiles); virtual Common::StringArray listSavefiles(const Common::String &pattern); virtual Common::InSaveFile *openRawFile(const Common::String &filename); virtual Common::InSaveFile *openForLoading(const Common::String &filename); @@ -75,6 +76,12 @@ protected: */ SaveFileCache _saveFileCache; + /** + * List of "locked" files. These cannot be used for saving/loading + * because CloudManager is downloading those. + */ + Common::StringArray _lockedFiles; + private: /** * The currently cached directory. |