From 7c5cf1b400808865a5f601f70d624ad6704a0c8c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 10 Jun 2012 04:49:42 +0200 Subject: GUI: Add helper to SaveLoadChooser, which uses the currently active target. This reduces the code duplication in all client code, which formerly duplicated the querying of the plugin, game id etc. and now simply calls the newly added method runModalWithCurrentTarget() on a SaveLoadChooser object. --- engines/cge/events.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'engines/cge/events.cpp') diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp index e903584100..095aac2412 100644 --- a/engines/cge/events.cpp +++ b/engines/cge/events.cpp @@ -70,11 +70,8 @@ bool Keyboard::getKey(Common::Event &event) { return false; case Common::KEYCODE_F5: if (_vm->canSaveGameStateCurrently()) { - const EnginePlugin *plugin = NULL; - EngineMan.findGame(_vm->_gameDescription->gameid, &plugin); - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); - int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + int16 savegameId = dialog->runModalWithCurrentTarget(); Common::String savegameDescription = dialog->getResultString(); delete dialog; @@ -84,11 +81,8 @@ bool Keyboard::getKey(Common::Event &event) { return false; case Common::KEYCODE_F7: if (_vm->canLoadGameStateCurrently()) { - const EnginePlugin *plugin = NULL; - EngineMan.findGame(_vm->_gameDescription->gameid, &plugin); - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false); - int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + int16 savegameId = dialog->runModalWithCurrentTarget(); delete dialog; if (savegameId != -1) -- cgit v1.2.3