summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-01-20 01:42:11 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2012-02-03 14:40:45 +0100
commit94deb596ae86bfe453c9d88e85266caae26e3980 (patch)
treeafb9f3cc90a832420b28b7cb470078b100e11812 /src/net/tmwa
parent86c4819bee1bcd990b6be20f36dcb26938acac8e (diff)
downloadmana-94deb596ae86bfe453c9d88e85266caae26e3980.tar.gz
mana-94deb596ae86bfe453c9d88e85266caae26e3980.tar.bz2
mana-94deb596ae86bfe453c9d88e85266caae26e3980.tar.xz
mana-94deb596ae86bfe453c9d88e85266caae26e3980.zip
Simplified and made generic the way the pickup is handled.
I also made the range be taken from the server type as for the pickup and npc talk ranges. Last but no least, I fixed the parameters sent with PGMSG_PICKUP to send the (item) position where to pickup at as described in the manaserv protocol. The pickup is still not 100% functional due certainly to two problems: 1. The client item coordinates might not be the exact same as in the server. 2. The client seems to try to pick up the item a bit too soon, probably for the reason given in 1. I'll investigate this in another patch. Reviewed-by: Thorbjørn Lindeijer, Erik Schilling.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/gamehandler.cpp7
-rw-r--r--src/net/tmwa/gamehandler.h4
2 files changed, 11 insertions, 0 deletions
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index e4dc62b0..93f0b86f 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -177,4 +177,11 @@ void GameHandler::setMap(const std::string map)
mMap = map.substr(0, map.rfind("."));
}
+int GameHandler::getPickupRange() const
+{
+ if (Game *game = Game::instance())
+ return game->getCurrentTileWidth();
+ return DEFAULT_TILE_LENGTH;
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/gamehandler.h b/src/net/tmwa/gamehandler.h
index 968a80c9..4f0525b9 100644
--- a/src/net/tmwa/gamehandler.h
+++ b/src/net/tmwa/gamehandler.h
@@ -62,6 +62,10 @@ class GameHandler : public MessageHandler, public Net::GameHandler,
/** The tmwAthena protocol is making use of the MP status bar. */
bool canUseMagicBar() const { return true; }
+ int getPickupRange() const;
+
+ int getNpcTalkRange() const { return DEFAULT_TILE_LENGTH * 30; }
+
private:
std::string mMap; ///< Keeps the map filename.
int mCharID; /// < Saved for map-server switching