summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 69793299..78171ca9 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -721,26 +721,16 @@ Path Map::findTilePath(int startPixelX, int startPixelY, int endPixelX,
if (myPath.empty())
return myPath;
- // Convert the map path to pixels over tiles
- // And add interpolation between the starting and ending offsets
+ // Convert the map path to pixels from the tile position
Path::iterator it = myPath.begin();
while (it != myPath.end())
{
- // A position that is valid on the start and end tile is not
- // necessarily valid on all the tiles in between, so check the offsets.
+ // The new pixel position will be the tile center.
*it = Position(it->x * mTileWidth + mTileWidth / 2,
it->y * mTileHeight + mTileHeight / 2);
- it++;
+ ++it;
}
- // Remove the last path node, as it's more clever to go to the destination.
- // It also permit to avoid zigzag at the end of the path,
- // especially with mouse.
- Position destination((endPixelX / mTileWidth) * mTileWidth + mTileWidth / 2,
- (endPixelY / mTileHeight) * mTileHeight + mTileHeight / 2);
- myPath.pop_back();
- myPath.push_back(destination);
-
return myPath;
}