X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fworldmap%2Ftux.cpp;h=f505fc263a5fb935456b054f59fc201a0fdabc06;hb=8359a7408f6528b3d3e05d669fe081ccd6d2a19b;hp=0aa3c21a8d4e432089aa50955a24aa6d7dc3db84;hpb=f9eba980c51c60137ec197182d140e0f76a8d7b2;p=supertux.git diff --git a/src/worldmap/tux.cpp b/src/worldmap/tux.cpp index 0aa3c21a8..f505fc263 100644 --- a/src/worldmap/tux.cpp +++ b/src/worldmap/tux.cpp @@ -30,6 +30,7 @@ #include "sprite_change.hpp" #include "control/joystickkeyboardcontroller.hpp" #include "scripting/squirrel_util.hpp" +#include "tile.hpp" #include "main.hpp" namespace WorldMapNS @@ -148,9 +149,9 @@ bool Tux::canWalk(int tile_data, Direction dir) { return ((tile_data & Tile::WORLDMAP_NORTH && dir == D_NORTH) || - (tile_data & Tile::WORLDMAP_SOUTH && dir == D_SOUTH) || - (tile_data & Tile::WORLDMAP_EAST && dir == D_EAST) || - (tile_data & Tile::WORLDMAP_WEST && dir == D_WEST)); + (tile_data & Tile::WORLDMAP_SOUTH && dir == D_SOUTH) || + (tile_data & Tile::WORLDMAP_EAST && dir == D_EAST) || + (tile_data & Tile::WORLDMAP_WEST && dir == D_WEST)); } void @@ -181,9 +182,9 @@ Tux::tryContinueWalking(float elapsed_time) // direction and the apply_action_ are opposites, since they "see" // directions in a different way if((direction == D_NORTH && special_tile->apply_action_south) || - (direction == D_SOUTH && special_tile->apply_action_north) || - (direction == D_WEST && special_tile->apply_action_east) || - (direction == D_EAST && special_tile->apply_action_west)) + (direction == D_SOUTH && special_tile->apply_action_north) || + (direction == D_WEST && special_tile->apply_action_east) || + (direction == D_EAST && special_tile->apply_action_west)) { if(special_tile->passive_message) { worldmap->passive_message = special_tile->map_message; @@ -218,11 +219,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) @@ -252,7 +251,7 @@ Tux::tryContinueWalking(float elapsed_time) Vector next_tile; if (!worldmap->path_ok(direction, tile_pos, &next_tile)) { - log_warning << "Tilemap data is buggy" << std::endl; + log_debug << "Tilemap data is buggy" << std::endl; stop(); return; }