From bf857a73fe69576909045a00f2ec318302ae84fb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 9 Nov 2008 17:53:37 +0000 Subject: Save game descriptions are now set correctly in the GMM save dialog svn-id: r34965 --- gui/launcher.cpp | 19 +++++++++++++++---- gui/launcher.h | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'gui') diff --git a/gui/launcher.cpp b/gui/launcher.cpp index b4802b06e8..df6869234e 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -524,6 +524,7 @@ int SaveLoadChooser::runModal(const EnginePlugin *plugin, const String &target) _thumbnailSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportThumbnail); _saveDateSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportCreationDate); _playTimeSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportPlayTime); + _resultString = ""; reflowLayout(); updateSaveList(); @@ -536,7 +537,7 @@ int SaveLoadChooser::runModal(const EnginePlugin *plugin, const String &target) } const Common::String &SaveLoadChooser::getResultString() const { - return _list->getSelectedString(); + return (_list->getSelected() > -1) ? _list->getSelectedString() : _resultString; } void SaveLoadChooser::setSaveMode(bool saveMode) { @@ -553,13 +554,20 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da if (selItem >= 0) { if (_list->isEditable() || !_list->getSelectedString().empty()) { _list->endEditMode(); - setResult(atoi(_saveList[selItem].save_slot().c_str())); + if (!_saveList.empty()) { + setResult(atoi(_saveList[selItem].save_slot().c_str())); + _resultString = _list->getSelectedString(); + } close(); } } break; case kChooseCmd: - setResult(atoi(_saveList[selItem].save_slot().c_str())); + _list->endEditMode(); + if (!_saveList.empty()) { + setResult(atoi(_saveList[selItem].save_slot().c_str())); + _resultString = _list->getSelectedString(); + } close(); break; case GUI::kListSelectionChangedCmd: { @@ -747,8 +755,11 @@ void SaveLoadChooser::updateSaveList() { // Fill the rest of the save slots with empty saves Common::String emptyDesc; - for (int i = curSlot + 1; i <= (*_plugin)->getMaximumSaveSlot(); i++) + for (int i = curSlot + 1; i <= (*_plugin)->getMaximumSaveSlot(); i++) { saveNames.push_back(emptyDesc); + SaveStateDescriptor dummySave(i, ""); + _saveList.push_back(dummySave); + } _list->setList(saveNames); } diff --git a/gui/launcher.h b/gui/launcher.h index 9e101c0dd8..fd13deba07 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -101,6 +101,7 @@ protected: bool _playTimeSupport; String _target; SaveStateList _saveList; + String _resultString; uint8 _fillR, _fillG, _fillB; -- cgit v1.2.3