[Scummvm-cvs-logs] SF.net SVN: scummvm: [23755] scummvm/branches/branch-0-9-0/engines/sword2/sword2.cpp
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Sat Aug 26 14:02:33 CEST 2006
Revision: 23755
Author: eriktorbjorn
Date: 2006-08-26 05:02:29 -0700 (Sat, 26 Aug 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=23755&view=rev
Log Message:
-----------
Backported fix for bug #1544796. (The one that would create a new entry in the
ScummVM config file when trying to start an undefined target.)
Modified Paths:
--------------
scummvm/branches/branch-0-9-0/engines/sword2/sword2.cpp
Modified: scummvm/branches/branch-0-9-0/engines/sword2/sword2.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/sword2/sword2.cpp 2006-08-26 11:56:49 UTC (rev 23754)
+++ scummvm/branches/branch-0-9-0/engines/sword2/sword2.cpp 2006-08-26 12:02:29 UTC (rev 23755)
@@ -112,9 +112,29 @@
}
PluginError Engine_SWORD2_create(OSystem *syst, Engine **engine) {
+ assert(syst);
assert(engine);
- *engine = new Sword2::Sword2Engine(syst);
- return kNoError;
+
+ FSList fslist;
+ FilesystemNode dir(ConfMan.get("path"));
+ if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
+ warning("Sword2Engine: invalid game path '%s'", dir.path().c_str());
+ return kInvalidPathError;
+ }
+
+ // Invoke the detector
+ Common::String gameid = ConfMan.get("gameid");
+ DetectedGameList detectedGames = Engine_SWORD2_detectGames(fslist);
+
+ for (uint i = 0; i < detectedGames.size(); i++) {
+ if (detectedGames[i].gameid == gameid) {
+ *engine = new Sword2::Sword2Engine(syst);
+ return kNoError;
+ }
+ }
+
+ warning("Sword2Engine: Unable to locate game data at path '%s'", dir.path().c_str());
+ return kNoGameDataFoundError;
}
REGISTER_PLUGIN(SWORD2, "Broken Sword 2");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list