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:
parent
9b05f4e103
commit
7c5cf1b400
13 changed files with 34 additions and 68 deletions
|
@ -795,8 +795,6 @@ int AgiEngine::selectSlot() {
|
|||
}
|
||||
|
||||
int AgiEngine::scummVMSaveLoadDialog(bool isSave) {
|
||||
const EnginePlugin *plugin = NULL;
|
||||
EngineMan.findGame(ConfMan.get("gameid"), &plugin);
|
||||
GUI::SaveLoadChooser *dialog;
|
||||
Common::String desc;
|
||||
int slot;
|
||||
|
@ -804,7 +802,7 @@ int AgiEngine::scummVMSaveLoadDialog(bool isSave) {
|
|||
if (isSave) {
|
||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
|
||||
|
||||
slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
||||
slot = dialog->runModalWithCurrentTarget();
|
||||
desc = dialog->getResultString();
|
||||
|
||||
if (desc.empty()) {
|
||||
|
@ -824,7 +822,7 @@ int AgiEngine::scummVMSaveLoadDialog(bool isSave) {
|
|||
desc = Common::String(desc.c_str(), 28);
|
||||
} else {
|
||||
dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
|
||||
slot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
||||
slot = dialog->runModalWithCurrentTarget();
|
||||
}
|
||||
|
||||
delete dialog;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue