summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.cpp9
-rw-r--r--src/localplayer.cpp4
2 files changed, 4 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 270affb5..77544058 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -607,13 +607,8 @@ void Game::handleInput()
{
case KeyboardConfig::KEY_PICKUP:
{
- const Vector &pos = player_node->getPosition();
- Map *map = viewport->getCurrentMap();
- Uint16 x = (int) pos.x / map->getTileWidth();
- Uint16 y = (int) (pos.y - 1)
- / map->getTileHeight();
- // y - 1 needed to fix position, otherwise, it's
- // off under eAthena.
+ int x = player_node->getTileX();
+ int y = player_node->getTileY();
FloorItem *item =
floorItemManager->findByCoordinates(x, y);
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 5f5f44ae..7826596c 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -707,8 +707,8 @@ void LocalPlayer::setInvItem(int index, int id, int amount)
void LocalPlayer::pickUp(FloorItem *item)
{
- int dx = item->getX() - (int) getPosition().x / mMap->getTileWidth();
- int dy = item->getY() - ((int) getPosition().y - 1) / mMap->getTileHeight();
+ int dx = item->getX() - getTileX();
+ int dy = item->getY() - getTileY();
if (dx * dx + dy * dy < 4)
{