[Scummvm-cvs-logs] CVS: scummvm/common main.cpp,1.6,1.7
Max Horn
fingolfin at users.sourceforge.net
Thu Sep 19 17:14:17 CEST 2002
Update of /cvsroot/scummvm/scummvm/common
In directory usw-pr-cvs1:/tmp/cvs-serv15786/common
Modified Files:
main.cpp
Log Message:
quit should not exit(1) but rather exit(0) (mabye we should add a paramter 'bool success' to it that flags whether this is a normal exit or one with an error?)
Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/main.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- main.cpp 19 Sep 2002 23:49:38 -0000 1.6
+++ main.cpp 20 Sep 2002 00:12:58 -0000 1.7
@@ -96,6 +96,7 @@
int main(int argc, char *argv[])
{
+ int result;
#ifdef __DC__
extern void dc_init_hardware();
dc_init_hardware();
@@ -120,27 +121,42 @@
#endif
#endif
+ // Read the config file
scummcfg = new Config(scummhome, "scummvm");
scummcfg->set("versioninfo", SCUMMVM_VERSION);
- if (detector.detectMain(argc, argv))
- return (-1);
+
+ // Parse the command line information
+ result = detector.detectMain(argc, argv);
+ // Create the system object
OSystem *system = detector.createSystem();
- {
- OSystem::Property prop;
-
- prop.caption = (char *)detector.getGameName();
- system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
+ // TODO - if detectMain() returns an error, fire up the launcher dialog
+ // TODO - implement the launcher dialog; also implement some sort of generic
+ // error dialog, to be used by the launcher if e.g. the game data can't
+ // be found.
+ if (result) {
+ system->quit();
+ return (-1);
}
+ // Set the window caption (for OSystems that support it)
+ OSystem::Property prop;
+ prop.caption = (char *)detector.getGameName();
+ system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
+
// Create the game engine
Engine *engine = Engine::createFromDetector(&detector, system);
// Run the game engine
engine->go();
+ // Free up memory
+ delete engine;
delete scummcfg;
+
+ // ...and quit (the return 0 should never be reached)
+ system->quit();
return 0;
}
More information about the Scummvm-git-logs
mailing list