diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-10-09 19:42:13 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-10-09 19:42:13 +0000 |
commit | 3fe1772b1e00344365e3cf8204225be19925b9e5 (patch) | |
tree | 0f66dddac8e14787096c01368611efa53f453134 /src/map.cpp | |
parent | 8cc0423b0c0aaa5dd9e91f673a691e5e634988c1 (diff) | |
download | mana-3fe1772b1e00344365e3cf8204225be19925b9e5.tar.gz mana-3fe1772b1e00344365e3cf8204225be19925b9e5.tar.bz2 mana-3fe1772b1e00344365e3cf8204225be19925b9e5.tar.xz mana-3fe1772b1e00344365e3cf8204225be19925b9e5.zip |
Merged the movement branch into trunk
I consider this the only way forward. In my tests this code isn't actually
doing worse than what was there before. Of course some cases are a bit broken,
and I'm open to any kind of feedback so that we can fix those issues.
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/src/map.cpp b/src/map.cpp index 888ea3a8..e10e4fad 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -113,7 +113,7 @@ void MapLayer::draw(Graphics *graphics, // If drawing the fringe layer, make sure all sprites above this row of // tiles have been drawn if (mIsFringeLayer) { - while (si != sprites.end() && (*si)->getPixelY() <= y * 32 - 32) { + while (si != sprites.end() && (*si)->getPixelY() <= y * 32) { (*si)->draw(graphics, -scrollX, -scrollY); si++; } @@ -383,35 +383,6 @@ void Map::blockTile(int x, int y, BlockType type) } } -void Map::freeTile(int x, int y, BlockType type) -{ - if (type == BLOCKTYPE_NONE || x < 0 || y < 0 || x >= mWidth || y >= mHeight) - { - return; - } - - int tileNum = x + y * mWidth; - - if ((--mOccupation[type][tileNum]) <= 0) - { - switch (type) - { - case BLOCKTYPE_WALL: - mMetaTiles[tileNum].blockmask &= (BLOCKMASK_WALL xor 0xff); - break; - case BLOCKTYPE_CHARACTER: - mMetaTiles[tileNum].blockmask &= (BLOCKMASK_CHARACTER xor 0xff); - break; - case BLOCKTYPE_MONSTER: - mMetaTiles[tileNum].blockmask &= (BLOCKMASK_MONSTER xor 0xff); - break; - default: - // shut up! - break; - } - } -} - bool Map::getWalk(int x, int y, char walkmask) const { // You can't walk outside of the map @@ -450,7 +421,7 @@ static int const basicCost = 100; Path Map::findPath(int startX, int startY, int destX, int destY, unsigned char walkmask, int maxCost) { // Path to be built up (empty by default) - std::list<PATH_NODE> path; + std::list<Position> path; // Declare open list, a list with open tiles sorted on F cost std::priority_queue<Location> openList; @@ -612,7 +583,7 @@ Path Map::findPath(int startX, int startY, int destX, int destY, unsigned char w while (pathX != startX || pathY != startY) { // Add the new path node to the start of the path list - path.push_front(PATH_NODE(pathX, pathY)); + path.push_front(Position(pathX, pathY)); // Find out the next parent MetaTile *tile = getMetaTile(pathX, pathY); |