From 57763c519b16bf063add4b46bf2856873de9db61 Mon Sep 17 00:00:00 2001 From: Wolfgang Becker Date: Mon, 24 Jul 2006 15:32:29 +0000 Subject: [PATCH] If player is at illegal position on worldmap, "action" respawns at "main". SVN-Revision: 4080 --- src/worldmap/worldmap.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 7ee9c5ee1..23c99d8b3 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -544,6 +544,13 @@ WorldMap::update(float delta) /* Check level action */ LevelTile* level = at_level(); if (!level) { + //Respawn if player on a tile with no level and nowhere to go. + const Tile* tile = at(tux->get_tile_pos()); + if(!( tile->getData() & ( Tile::WORLDMAP_NORTH | Tile::WORLDMAP_SOUTH | Tile::WORLDMAP_WEST | Tile::WORLDMAP_EAST ))){ + log_warning << "Player at illegal position " << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << " respawning." << std::endl; + move_to_spawnpoint("main"); + return; + } log_warning << "No level to enter at: " << tux->get_tile_pos().x << ", " << tux->get_tile_pos().y << std::endl; return; } -- 2.11.0