diff options
author | Filippos Karapetis | 2008-11-09 17:53:37 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-11-09 17:53:37 +0000 |
commit | bf857a73fe69576909045a00f2ec318302ae84fb (patch) | |
tree | 5d8e48cb0d70cf4cf16683d8e602d20b095646c4 | |
parent | ed1b12571b7ba9822e9776a31e427a829d4020cf (diff) | |
download | scummvm-rg350-bf857a73fe69576909045a00f2ec318302ae84fb.tar.gz scummvm-rg350-bf857a73fe69576909045a00f2ec318302ae84fb.tar.bz2 scummvm-rg350-bf857a73fe69576909045a00f2ec318302ae84fb.zip |
Save game descriptions are now set correctly in the GMM save dialog
svn-id: r34965
-rw-r--r-- | engines/dialogs.cpp | 4 | ||||
-rw-r--r-- | gui/launcher.cpp | 19 | ||||
-rw-r--r-- | gui/launcher.h | 1 |
3 files changed, 17 insertions, 7 deletions
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index ce7907f965..9ef5ba749a 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -166,9 +166,7 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat int slot = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName()); if (slot >= 0) { - // FIXME: at this point, the save list's selItem is -1! - //Common::String result(_saveDialog->getResultString()); - Common::String result; + Common::String result(_saveDialog->getResultString()); if (result.empty()) { // If the user was lazy and entered no save name, come up with a default name. char buf[20]; 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; |