diff options
-rw-r--r-- | src/being.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.cpp | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp index c13b52f7..d133225f 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -192,6 +192,12 @@ void Being::setDestination(int dstX, int dstY) it++; } + // Remove the last path node, as it's more clever to go to mDest instead. + // It also permit to avoid zigzag at the end of the path, + // especially with mouse. + thisPath.pop_back(); + thisPath.push_back(Position(mDest.x, mDest.y)); + setPath(thisPath); } #endif // TMWSERV_SUPPORT @@ -534,7 +540,7 @@ void Being::logic() const float nominalLength = dir.length(); // When we've not reached our destination, move to it. - if (nominalLength > 0.0f && mWalkSpeed > 0.0f) + if (nominalLength > 1.0f && mWalkSpeed > 0.0f) { // The private mWalkSpeed member is the speed in tiles per second. diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index ce1990ed..bbb5a203 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -381,8 +381,7 @@ void PlayerHandler::setDestination(int x, int y, int /* direction */) void PlayerHandler::changeAction(Being::Action action) { - if (action == Being::SIT) - player_node->setAction(action); + player_node->setAction(action); MessageOut msg(PGMSG_ACTION_CHANGE); msg.writeInt8(action); |