From: Ondřej Hošek Date: Thu, 13 Apr 2006 11:53:31 +0000 (+0000) Subject: * Tux now stops at crossroads on worldmaps X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=1ebbfa05ccedec74dfe0269da1a154de51268191;p=supertux.git * Tux now stops at crossroads on worldmaps * Fixed crasher when exiting from level opened via commandline * Fixed an error in one of the Cobble test levels SVN-Revision: 3324 --- diff --git a/data/levels/world2/christoph1.stl b/data/levels/world2/christoph1.stl index 9fe08a3cd..6540e509d 100644 --- a/data/levels/world2/christoph1.stl +++ b/data/levels/world2/christoph1.stl @@ -130,13 +130,13 @@ (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();") ) ) ) diff --git a/src/game_session.cpp b/src/game_session.cpp index 8aa35aa16..d4681c5df 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -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" diff --git a/src/mainloop.cpp b/src/mainloop.cpp index 6c21a3a1f..e65f8c9f2 100644 --- a/src/mainloop.cpp +++ b/src/mainloop.cpp @@ -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(); diff --git a/src/tile.hpp b/src/tile.hpp index 88ed0551f..efeae2eb7 100644 --- a/src/tile.hpp +++ b/src/tile.hpp @@ -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 { diff --git a/src/worldmap.cpp b/src/worldmap.cpp index ad17b0100..0ce2a3e0a 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -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