From: Christoph Sommer Date: Sun, 18 Nov 2007 12:26:06 +0000 (+0000) Subject: Do not skip auto-walk code if player tries to walk in invalid direction X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=82589a60dd1359c3e1138c3afa0059b07eddb375;p=supertux.git Do not skip auto-walk code if player tries to walk in invalid direction (fixes issue #254) SVN-Revision: 5184 --- diff --git a/src/worldmap/tux.cpp b/src/worldmap/tux.cpp index b4ea3f70a..b81fb626f 100644 --- a/src/worldmap/tux.cpp +++ b/src/worldmap/tux.cpp @@ -218,11 +218,9 @@ Tux::tryContinueWalking(float elapsed_time) // if user wants to change direction, try changing, else guess the direction in which to walk next const int tile_data = worldmap->tile_data_at(tile_pos); - if (direction != input_direction) { - if(canWalk(tile_data, input_direction)) { - direction = input_direction; - back_direction = reverse_dir(direction); - } + if ((direction != input_direction) && canWalk(tile_data, input_direction)) { + direction = input_direction; + back_direction = reverse_dir(direction); } else { Direction dir = D_NONE; if (tile_data & Tile::WORLDMAP_NORTH && back_direction != D_NORTH)