diff options
author | Chuck Miller <shadowmil@gmail.com> | 2009-08-01 13:14:45 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2009-08-01 21:41:46 -0400 |
commit | 455b56f0a3aa89fec063696ef86aa39986b21a5f (patch) | |
tree | e8c9b80143339762db66a627392e34df47e82df2 | |
parent | 5858cbe02393c64ae75952f390bd2012082bcc5b (diff) | |
download | mana-455b56f0a3aa89fec063696ef86aa39986b21a5f.tar.gz mana-455b56f0a3aa89fec063696ef86aa39986b21a5f.tar.bz2 mana-455b56f0a3aa89fec063696ef86aa39986b21a5f.tar.xz mana-455b56f0a3aa89fec063696ef86aa39986b21a5f.zip |
Remove some unused movement methods
-rw-r--r-- | src/being.cpp | 32 | ||||
-rw-r--r-- | src/being.h | 15 | ||||
-rw-r--r-- | src/map.cpp | 44 | ||||
-rw-r--r-- | src/map.h | 7 | ||||
-rw-r--r-- | src/player.cpp | 15 | ||||
-rw-r--r-- | src/player.h | 5 |
6 files changed, 8 insertions, 110 deletions
diff --git a/src/being.cpp b/src/being.cpp index b915e797..5395f064 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -148,37 +148,21 @@ void Being::setDestination(Uint16 destX, Uint16 destY) #endif #ifdef TMWSERV_SUPPORT - -void Being::adjustCourse(int srcX, int srcY) -{ - setDestination(srcX, srcY, mDest.x, mDest.y); -} - void Being::setDestination(int dstX, int dstY) { - setDestination(mPos.x, mPos.y, dstX, dstY); -} + mDest.x = dstX; + mDest.y = dstY; + int srcX = mPos.x; + int srcY = mPos.y; -Path Being::findPath() -{ - Path path; + Path thisPath; if (mMap) { - path = mMap->findPath(mPos.x / 32, mPos.y / 32, - mDest.x / 32, mDest.y / 32, getWalkMask()); + thisPath = mMap->findPath(mPos.x / 32, mPos.y / 32, + mDest.x / 32, mDest.y / 32, getWalkMask()); } - return path; -} - -void Being::setDestination(int srcX, int srcY, int dstX, int dstY) -{ - mDest.x = dstX; - mDest.y = dstY; - - Path thisPath = findPath(); - if (thisPath.empty()) { setPath(Path()); @@ -228,7 +212,7 @@ void Being::setPath(const Path &path) { mPath = path; #ifdef TMWSERV_SUPPORT -// std::cout << this << " New path: " << path << std::endl; + std::cout << this << " New path: " << path << std::endl; #else if (mAction != WALK && mAction != DEAD) { diff --git a/src/being.h b/src/being.h index e16e464d..6e90b39d 100644 --- a/src/being.h +++ b/src/being.h @@ -183,26 +183,11 @@ class Being : public Sprite, public ConfigListener virtual void setDestination(Uint16 destX, Uint16 destY); #else /** - * Returns the path to the being's current destination - */ - virtual Path findPath(); - - /** - * Creates a path for the being from sx,sy to ex,ey - */ - void setDestination(int sx, int sy, int ex, int ey); - - /** * Creates a path for the being from current position to ex and ey */ void setDestination(int ex, int ey); /** - * Adjusts course to expected start point. - */ - void adjustCourse(int srcX, int srcY); - - /** * Returns the destination for this being. */ const Vector &getDestination() const { return mDest; } diff --git a/src/map.cpp b/src/map.cpp index 81bf7313..dbecda3d 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -491,50 +491,6 @@ const std::string &Map::getName() const return getProperty("mapname"); } -Path Map::findSimplePath(int startX, int startY, - int destX, int destY, - unsigned char walkmask) -{ - // Path to be built up (empty by default) - Path path; - int positionX = startX, positionY = startY; - int directionX, directionY; - // Checks our path up to 1 tiles, if a blocking tile is found - // We go to the last good tile, and break out of the loop - while(true) - { - directionX = destX - positionX; - directionY = destY - positionY; - - if (directionX > 0) - directionX = 1; - else if(directionX < 0) - directionX = -1; - - if (directionY > 0) - directionY = 1; - else if(directionY < 0) - directionY = -1; - - positionX += directionX; - positionY += directionY; - - if (getWalk(positionX, positionY, walkmask)) - { - path.push_back(Position(positionX, positionY)); - - if ((positionX == destX) && (positionY == destY)) - { - return path; - } - } - else - { - return path; - } - } -} - static int const basicCost = 100; Path Map::findPath(int startX, int startY, int destX, int destY, @@ -258,13 +258,6 @@ class Map : public Properties const std::string &getName() const; /** - * Find a simple path from one location to the next. - */ - Path findSimplePath(int startX, int startY, - int destX, int destY, - unsigned char walkmask); - - /** * Find a path from one location to the next. */ Path findPath(int startX, int startY, int destX, int destY, diff --git a/src/player.cpp b/src/player.cpp index 3b2271bd..fd7cd0d6 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -255,21 +255,6 @@ void Player::updateCoords() } #ifdef TMWSERV_SUPPORT - -Path Player::findPath() -{ - Path path; - - if (mMap) - { - path = mMap->findSimplePath(getPosition().x / 32, getPosition().y / 32, - getDestination().x / 32, getDestination().y / 32, - getWalkMask()); - } - - return path; -} - Guild* Player::addGuild(short guildId, short rights) { Guild *guild = new Guild(guildId, rights); diff --git a/src/player.h b/src/player.h index cfd305a6..9a5c6c94 100644 --- a/src/player.h +++ b/src/player.h @@ -93,11 +93,6 @@ class Player : public Being #ifdef TMWSERV_SUPPORT /** - * Returns the path to the player's current destination - */ - Path findPath(); - - /** * Adds a guild to the player. */ Guild *addGuild(short guildId, short rights); |