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.
This commit is contained in:
Johannes Schickel 2012-06-10 04:49:42 +02:00
parent 9b05f4e103
commit 7c5cf1b400
13 changed files with 34 additions and 68 deletions

View file

@ -214,12 +214,7 @@ void MainMenuDialog::reflowLayout() {
}
void MainMenuDialog::save() {
const Common::String gameId = ConfMan.get("gameid");
const EnginePlugin *plugin = 0;
EngineMan.findGame(gameId, &plugin);
int slot = _saveDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
int slot = _saveDialog->runModalWithCurrentTarget();
if (slot >= 0) {
Common::String result(_saveDialog->getResultString());
@ -250,12 +245,7 @@ void MainMenuDialog::save() {
}
void MainMenuDialog::load() {
const Common::String gameId = ConfMan.get("gameid");
const EnginePlugin *plugin = 0;
EngineMan.findGame(gameId, &plugin);
int slot = _loadDialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
int slot = _loadDialog->runModalWithCurrentTarget();
_engine->setGameToLoadSlot(slot);