Do not skip auto-walk code if player tries to walk in invalid direction
authorChristoph Sommer <mail@christoph-sommer.de>
Sun, 18 Nov 2007 12:26:06 +0000 (12:26 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Sun, 18 Nov 2007 12:26:06 +0000 (12:26 +0000)
(fixes issue #254)

SVN-Revision: 5184

src/worldmap/tux.cpp

index b4ea3f7..b81fb62 100644 (file)
@@ -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)