aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2008-11-06 20:26:19 +0000
committerFilippos Karapetis2008-11-06 20:26:19 +0000
commit27d195968380963220f55caf62b767cd19626ed3 (patch)
tree89ffdb401b76babfda61c9f0444d0e348c6c18f6 /engines
parent54b94fdf037bcaf1f9df678f26a23e241a1d8e21 (diff)
downloadscummvm-rg350-27d195968380963220f55caf62b767cd19626ed3.tar.gz
scummvm-rg350-27d195968380963220f55caf62b767cd19626ed3.tar.bz2
scummvm-rg350-27d195968380963220f55caf62b767cd19626ed3.zip
Added some WIP code for the GMM save dialog (still not working correctly)
svn-id: r34918
Diffstat (limited to 'engines')
-rw-r--r--engines/dialogs.cpp18
-rw-r--r--engines/dialogs.h2
2 files changed, 16 insertions, 4 deletions
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 95be09184f..40cec8e10b 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -118,13 +118,15 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
_aboutDialog = new GUI::AboutDialog();
_optionsDialog = new ConfigDialog();
_loadDialog = new GUI::SaveLoadChooser("Load game:", "Load");
+ _saveDialog = new GUI::SaveLoadChooser("Save game:", "Save");
+ _saveDialog->setSaveMode(true);
}
MainMenuDialog::~MainMenuDialog() {
delete _aboutDialog;
delete _optionsDialog;
delete _loadDialog;
- //delete _saveDialog;
+ delete _saveDialog;
}
void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
@@ -154,16 +156,26 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
break;
case kSaveCmd:
/*
+ {
Common::String gameId = ConfMan.get("gameid");
const EnginePlugin *plugin = 0;
EngineMan.findGame(gameId, &plugin);
int slot = _saveDialog->runModal(plugin, ConfMan.getActiveDomainName());
- Common::String desc = ... get desired description from _saveDialog ...
if (slot >= 0) {
- _engine->saveGameState(slot, desc.c_str());
+ Common::String result(_saveDialog->getResultString());
+ char *desc;
+ if (result.empty()) {
+ // If the user was lazy and entered no save name, come up with a default name.
+ desc = new char[20];
+ sprintf(desc, "Save %d", slot + 1);
+ } else {
+ desc = (char*)result.c_str();
+ }
+
+ _engine->saveGameState(slot, desc);
close();
}
diff --git a/engines/dialogs.h b/engines/dialogs.h
index e93b069636..0e715e6fb6 100644
--- a/engines/dialogs.h
+++ b/engines/dialogs.h
@@ -59,7 +59,7 @@ protected:
GUI::Dialog *_aboutDialog;
GUI::Dialog *_optionsDialog;
GUI::SaveLoadChooser *_loadDialog;
-
+ GUI::SaveLoadChooser *_saveDialog;
};
class ConfigDialog : public GUI::OptionsDialog {