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. --- gui/saveload.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gui/saveload.cpp') diff --git a/gui/saveload.cpp b/gui/saveload.cpp index c7da94357f..366efa7a90 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -76,6 +76,15 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel, SaveLoadChooser::~SaveLoadChooser() { } +int SaveLoadChooser::runModalWithCurrentTarget() { + const Common::String gameId = ConfMan.get("gameid"); + + const EnginePlugin *plugin = 0; + EngineMan.findGame(gameId, &plugin); + + return runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); +} + int SaveLoadChooser::runModalWithPluginAndTarget(const EnginePlugin *plugin, const String &target) { if (_gfxWidget) _gfxWidget->setGfx(0); -- cgit v1.2.3