changed camera to show more of what's above tux
[supertux.git] / src / worldmap.cpp
index 872c285..9f0c0c3 100644 (file)
@@ -843,11 +843,16 @@ WorldMap::update(float delta)
          the level (in case there is one), don't show anything */
       if(level_finished) {
         if (level->extro_script != "") {
-          ScriptInterpreter* interpreter = new ScriptInterpreter(levels_path);
-          std::istringstream in(level->extro_script);
-          interpreter->load_script(in, "level-extro-script");
-          interpreter->start_script();
-          add_object(interpreter);
+          try {
+            std::auto_ptr<ScriptInterpreter> interpreter 
+              (new ScriptInterpreter(levels_path));
+            std::istringstream in(level->extro_script);
+            interpreter->load_script(in, "level-extro-script");
+            interpreter->start_script();
+            add_object(interpreter.release());
+          } catch(std::exception& e) {
+            std::cerr << "Couldn't run level-extro-script:" << e.what() << "\n";
+          }
         }
 
         if (!level->next_worldmap.empty())
@@ -972,7 +977,7 @@ WorldMap::draw_status(DrawingContext& context)
         }
     }
   /* Display a passive message in the map, if needed */
-  if(passive_message_timer.check())
+  if(passive_message_timer.started())
     context.draw_text(gold_text, passive_message, 
             Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT - white_text->get_height() - 60),
             CENTER_ALLIGN, LAYER_FOREGROUND1);
@@ -991,11 +996,17 @@ WorldMap::display()
   sound_manager->play_music(song);
 
   if(!intro_displayed && intro_script != "") {
-    ScriptInterpreter* interpreter = new ScriptInterpreter(levels_path);
-    std::istringstream in(intro_script);
-    interpreter->load_script(in, "worldmap-intro-script");
-    interpreter->start_script();
-    add_object(interpreter);
+    try {
+      std::auto_ptr<ScriptInterpreter> interpreter 
+        (new ScriptInterpreter(levels_path));
+      std::istringstream in(intro_script);
+      interpreter->load_script(in, "worldmap-intro-script");
+      interpreter->start_script();
+      add_object(interpreter.release());
+    } catch(std::exception& e) {
+      std::cerr << "Couldn't execute worldmap-intro-script: "
+        << e.what() << "\n";
+    }
                                            
     intro_displayed = true;
   }