diff options
author | Max Horn | 2005-01-01 18:53:47 +0000 |
---|---|---|
committer | Max Horn | 2005-01-01 18:53:47 +0000 |
commit | f52be9df681358564991e0988bf70160970104ad (patch) | |
tree | d7de4493e5f6e7c0b229014707a915d0b42d07e3 /base | |
parent | 03d4a6fa47e73ddbddc6bc096f6cef14ea7d7441 (diff) | |
download | scummvm-rg350-f52be9df681358564991e0988bf70160970104ad.tar.gz scummvm-rg350-f52be9df681358564991e0988bf70160970104ad.tar.bz2 scummvm-rg350-f52be9df681358564991e0988bf70160970104ad.zip |
Changed OSystem::instance() to return a reference, not a pointer (it now matches the Singleton interface)
svn-id: r16402
Diffstat (limited to 'base')
-rw-r--r-- | base/main.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/base/main.cpp b/base/main.cpp index 3203d59775..1fbaa96ff7 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -187,19 +187,19 @@ static void do_memory_test(void) { int gDebugLevel = 0; -static bool launcherDialog(GameDetector &detector, OSystem *system) { +static bool launcherDialog(GameDetector &detector, OSystem &system) { - system->beginGFXTransaction(); + system.beginGFXTransaction(); // Set the user specified graphics mode (if any). - system->setGraphicsMode(ConfMan.get("gfx_mode").c_str()); + system.setGraphicsMode(ConfMan.get("gfx_mode").c_str()); // GUI is (currently) always running at 320x200 - system->initSize(320, 200); - system->endGFXTransaction(); + system.initSize(320, 200); + system.endGFXTransaction(); // Clear the main screen - system->clearScreen(); + system.clearScreen(); // FIXME - mouse cursors are currently always set via 8 bit data. // Thus for now we need to setup a dummy palette. On the long run, we might @@ -226,7 +226,7 @@ static bool launcherDialog(GameDetector &detector, OSystem *system) { 255, 255, 255, 0, }; - system->setPalette(dummy_palette, 0, 16); + system.setPalette(dummy_palette, 0, 16); #if defined(_WIN32_WCE) CELauncherDialog dlg(detector); @@ -238,7 +238,7 @@ static bool launcherDialog(GameDetector &detector, OSystem *system) { return (dlg.runModal() != -1); } -static int runGame(GameDetector &detector, OSystem *system) { +static int runGame(GameDetector &detector, OSystem &system) { // Set the window caption to the game name Common::String caption(ConfMan.get("description", detector._targetName)); @@ -247,11 +247,11 @@ static int runGame(GameDetector &detector, OSystem *system) { if (caption.isEmpty()) caption = detector._targetName; if (!caption.isEmpty()) { - system->setWindowCaption(caption.c_str()); + system.setWindowCaption(caption.c_str()); } // Create the game engine - Engine *engine = detector.createEngine(system); + Engine *engine = detector.createEngine(&system); assert(engine); // Add extrapath (if any) to the directory search list @@ -275,7 +275,7 @@ static int runGame(GameDetector &detector, OSystem *system) { delete engine; // Stop all sound processing now (this prevents some race conditions later on) - system->clearSoundCallback(); + system.clearSoundCallback(); return result; } @@ -372,13 +372,13 @@ extern "C" int scummvm_main(GameDetector &detector, int argc, char *argv[]) { // Ensure the system object exists (it may have already been created // at an earlier point, though!) - OSystem *system = OSystem::instance(); + OSystem &system = OSystem::instance(); // Create the timer services - g_timer = new Timer(system); + g_timer = new Timer(&system); // Set initial window caption - system->setWindowCaption(gScummVMFullVersion); + system.setWindowCaption(gScummVMFullVersion); // Unless a game was specified, show the launcher dialog if (detector._targetName.isEmpty()) @@ -413,8 +413,10 @@ extern "C" int scummvm_main(GameDetector &detector, int argc, char *argv[]) { // ...and quit (the return 0 should never be reached) delete g_timer; - system->quit(); - delete system; + system.quit(); + + error("If you are seeing this, your OSystem backend is not working properly"); + return 0; } // allegro needs this for some reason... |