summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-27 13:25:41 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-27 13:25:41 +0300
commitc61f1b6abe8e68995f00ae3a939afe5049e5cdb3 (patch)
treec50613a2c7722fba4aba9d5a67949b118a279b33 /src/map.cpp
parentb481cd74dfd1629ca7b045cde57562e752c49638 (diff)
downloadplus-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.gz
plus-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.bz2
plus-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.xz
plus-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.zip
Remove manaserv ifdefs code.
ManaServ was already depricated long ago.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp125
1 files changed, 0 insertions, 125 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 4e654198c..70a48b811 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -800,131 +800,6 @@ const std::string Map::getFilename() const
return fileName.substr(lastSlash, fileName.rfind(".") - lastSlash);
}
-#ifdef MANASERV_SUPPORT
-Position Map::checkNodeOffsets(int radius, const unsigned char walkMask,
- const Position &position) const
-{
- // Pre-computing character's position in tiles
- const int tx = position.x / mapTileSize;
- const int ty = position.y / mapTileSize;
-
- // Pre-computing character's position offsets.
- int fx = position.x % mapTileSize;
- int fy = position.y % mapTileSize;
-
- // Compute the being radius:
- // FIXME: Hande beings with more than 1/2 tile radius by not letting them
- // go or spawn in too narrow places. The server will have to be aware
- // of being's radius value (in tiles) to handle this gracefully.
- if (radius > mapTileSize / 2)
- radius = mapTileSize / 2;
- // set a default value if no value returned.
- if (radius < 1)
- radius = mapTileSize / 3;
-
- // We check diagonal first as they are more restrictive.
- // Top-left border check
- if (!getWalk(tx - 1, ty - 1, walkMask)
- && fy < radius && fx < radius)
- {
- fx = radius;
- fy = radius;
- }
- // Top-right border check
- if (!getWalk(tx + 1, ty - 1, walkMask)
- && (fy < radius) && fx > (mapTileSize - radius))
- {
- fx = mapTileSize - radius;
- fy = radius;
- }
- // Bottom-left border check
- if (!getWalk(tx - 1, ty + 1, walkMask)
- && fy > (mapTileSize - radius) && fx < radius)
- {
- fx = radius;
- fy = mapTileSize - radius;
- }
- // Bottom-right border check
- if (!getWalk(tx + 1, ty + 1, walkMask)
- && fy > (mapTileSize - radius) && fx > (mapTileSize - radius))
- {
- fx = mapTileSize - radius;
- fy = fx;
- }
-
- // Fix coordinates so that the player does not seem to dig into walls.
- if (fx > (mapTileSize - radius) && !getWalk(tx + 1, ty, walkMask))
- fx = mapTileSize - radius;
- else if (fx < radius && !getWalk(tx - 1, ty, walkMask))
- fx = radius;
- else if (fy > (mapTileSize - radius) && !getWalk(tx, ty + 1, walkMask))
- fy = mapTileSize - radius;
- else if (fy < radius && !getWalk(tx, ty - 1, walkMask))
- fy = radius;
-
- return Position(tx * mapTileSize + fx, ty * mapTileSize + fy);
-}
-
-Path Map::findPixelPath(const int startPixelX, const int startPixelY,
- const int endPixelX, const int endPixelY,
- const int radius, const unsigned char walkMask,
- const int maxCost)
-{
- Path myPath = findPath(startPixelX / mapTileSize,
- startPixelY / mapTileSize,
- endPixelX / mapTileSize,
- endPixelY / mapTileSize,
- walkMask, maxCost);
-
- // Don't compute empty coordinates.
- if (myPath.empty())
- return myPath;
-
- // Find the starting offset
- const float startOffsetX = static_cast<float>(startPixelX % mapTileSize);
- const float startOffsetY = static_cast<float>(startPixelY % mapTileSize);
-
- // Find the ending offset
- const float endOffsetX = static_cast<float>(endPixelX % mapTileSize);
- const float endOffsetY = static_cast<float>(endPixelY % mapTileSize);
-
- const int sz = static_cast<int>(myPath.size());
- // Find the distance, and divide it by the number of steps
- const int changeX = static_cast<int>((endOffsetX - startOffsetX)
- / static_cast<float>(sz));
- const int changeY = static_cast<int>((endOffsetY - startOffsetY)
- / static_cast<float>(sz));
-
- // Convert the map path to pixels over tiles
- // And add interpolation between the starting and ending offsets
- Path::iterator it = myPath.begin();
- const Path::iterator it_end = myPath.end();
- int i = 0;
- while (it != it_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.
- *it = checkNodeOffsets(radius, walkMask,
- it->x * mapTileSize + startOffsetX
- + static_cast<float>(changeX * i),
- it->y * mapTileSize + startOffsetY
- + static_cast<float>(changeY * i));
- i++;
- ++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.
- const Position destination = checkNodeOffsets(radius, walkMask,
- endPixelX, endPixelY);
- myPath.pop_back();
- myPath.push_back(destination);
-
- return myPath;
-}
-#endif
-
Path Map::findPath(const int startX, const int startY,
const int destX, const int destY,
const unsigned char walkmask, const int maxCost)