* Tux now stops at crossroads on worldmaps
authorOndřej Hošek <ondra.hosek@gmail.com>
Thu, 13 Apr 2006 11:53:31 +0000 (11:53 +0000)
committerOndřej Hošek <ondra.hosek@gmail.com>
Thu, 13 Apr 2006 11:53:31 +0000 (11:53 +0000)
* Fixed crasher when exiting from level opened via commandline
* Fixed an error in one of the Cobble test levels

SVN-Revision: 3324

data/levels/world2/christoph1.stl
src/game_session.cpp
src/mainloop.cpp
src/tile.hpp
src/worldmap.cpp

index 9fe08a3..6540e50 100644 (file)
       (x 5996)
       (y 205)
       (sprite "images/powerups/potions/red-potion.sprite")
-      (script "levelflip();")
+      (script "Level.flip_vertically();")
     )
     (powerup
       (x 6423)
       (y 427)
       (sprite "images/powerups/potions/red-potion.sprite")
-      (script "levelflip();")
+      (script "Level.flip_vertically();")
     )
   )
 )
index 8aa35aa..d4681c5 100644 (file)
@@ -55,7 +55,6 @@
 #include "lisp/lisp.hpp"
 #include "lisp/parser.hpp"
 #include "resources.hpp"
-#include "worldmap.hpp"
 #include "misc.hpp"
 #include "statistics.hpp"
 #include "timer.hpp"
index 6c21a3a..e65f8c9 100644 (file)
@@ -64,6 +64,11 @@ MainLoop::push_screen(Screen* screen)
 void
 MainLoop::exit_screen()
 {
+  if (screen_stack.size() < 1)
+  {
+    quit();
+    return;
+  }
   next_screen.reset(screen_stack.back());
   nextpush = false;
   screen_stack.pop_back();
index 88ed055..efeae2e 100644 (file)
@@ -72,8 +72,15 @@ public:
     WORLDMAP_SOUTH = 0x0002,
     WORLDMAP_EAST  = 0x0004,
     WORLDMAP_WEST  = 0x0008,
-    
-    WORLDMAP_STOP  = 0x0010
+
+    WORLDMAP_STOP  = 0x0010,
+
+    // convenience values ("C" stands for crossroads)
+    WORLDMAP_CNSE  = WORLDMAP_NORTH | WORLDMAP_SOUTH | WORLDMAP_EAST,
+    WORLDMAP_CNSW  = WORLDMAP_NORTH | WORLDMAP_SOUTH | WORLDMAP_WEST,
+    WORLDMAP_CNEW  = WORLDMAP_NORTH | WORLDMAP_EAST  | WORLDMAP_WEST,
+    WORLDMAP_CSEW  = WORLDMAP_SOUTH | WORLDMAP_EAST  | WORLDMAP_WEST,
+    WORLDMAP_CNSEW = WORLDMAP_NORTH | WORLDMAP_SOUTH | WORLDMAP_EAST | WORLDMAP_WEST
   };
   
   struct ImageSpec {
index ad17b01..0ce2a3e 100644 (file)
@@ -699,7 +699,12 @@ WorldMap::finished_level(const std::string& filename)
   
     const Tile* tile = at(tux->get_tile_pos());
 
-    if (tile->getData() & Tile::WORLDMAP_NORTH
+    // first, test for crossroads
+    if (tile->getData() & Tile::WORLDMAP_CNSE || tile->getData() && Tile::WORLDMAP_CNSW
+     || tile->getData() & Tile::WORLDMAP_CNEW || tile->getData() && Tile::WORLDMAP_CSEW
+     || tile->getData() & Tile::WORLDMAP_CNSEW)
+      dir = D_NONE;
+    else if (tile->getData() & Tile::WORLDMAP_NORTH
         && tux->back_direction != D_NORTH)
       dir = D_NORTH;
     else if (tile->getData() & Tile::WORLDMAP_SOUTH