aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorChristopher Page2008-08-06 01:48:46 +0000
committerChristopher Page2008-08-06 01:48:46 +0000
commit8bcc4619ec8750266328367f910a4d1fea99eb43 (patch)
treef6b5ed20efe38488e0be375392a07868bf652a9c /gui
parentaf16043008edf6b8ca39993ebdee753d9d52c295 (diff)
downloadscummvm-rg350-8bcc4619ec8750266328367f910a4d1fea99eb43.tar.gz
scummvm-rg350-8bcc4619ec8750266328367f910a4d1fea99eb43.tar.bz2
scummvm-rg350-8bcc4619ec8750266328367f910a4d1fea99eb43.zip
Added a check to make sure there is an active engine available when trying to load a game from the launcher
svn-id: r33652
Diffstat (limited to 'gui')
-rw-r--r--gui/launcher.cpp39
-rw-r--r--gui/launcher.h2
2 files changed, 24 insertions, 17 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 2953988ed3..29e1365d70 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -919,33 +919,40 @@ void LauncherDialog::editGame(int item) {
}
void LauncherDialog::loadGame(int item) {
- int idx;
- _loadDialog->setList(generateSavegameList(item));
- idx = _loadDialog->runModal();
- if (idx >= 0) {
- ConfMan.setInt("save_slot", idx);
- ConfMan.setActiveDomain(_domains[item]);
- close();
- }
+ String gameId = ConfMan.get("gameid", _domains[item]);
+ if (gameId.empty())
+ gameId = _domains[item];
+
+ const EnginePlugin *plugin = 0;
+ GameDescriptor game = EngineMan.findGame(gameId, &plugin);
+
+ if (plugin) {
+ _loadDialog->setList(generateSavegameList(item, plugin));
+ int idx = _loadDialog->runModal();
+ if (idx >= 0) {
+ ConfMan.setInt("save_slot", idx);
+ ConfMan.setActiveDomain(_domains[item]);
+ close();
+ }
+ } else {
+ MessageDialog dialog("ScummVM could not find any engine capable of running the selected game!", "OK");
+ dialog.runModal();
+ }
}
-Common::StringList LauncherDialog::generateSavegameList(int item) {
+Common::StringList LauncherDialog::generateSavegameList(int item, const EnginePlugin *plugin) {
String gameId = ConfMan.get("gameid", _domains[item]);
if (gameId.empty())
gameId = _domains[item];
-
+
String description = _domains[item];
description.toLowercase();
- const EnginePlugin *plugin = 0;
- GameDescriptor game = EngineMan.findGame(gameId, &plugin);
-
- SaveStateList saveList = (*plugin)->listSaves(description.c_str());
StringList saveNames;
+ SaveStateList saveList = (*plugin)->listSaves(description.c_str());
- for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x) {
+ for (SaveStateList::const_iterator x = saveList.begin(); x != saveList.end(); ++x)
saveNames.push_back(x->description().c_str());
- }
return saveNames;
}
diff --git a/gui/launcher.h b/gui/launcher.h
index cff6f2a8ba..a26651eef5 100644
--- a/gui/launcher.h
+++ b/gui/launcher.h
@@ -75,7 +75,7 @@ protected:
void editGame(int item);
void loadGame(int item);
- StringList generateSavegameList(int item);
+ StringList generateSavegameList(int item, const EnginePlugin *plugin);
void selectGame(const String &name);
};