diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-01-19 18:15:54 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-01-22 12:05:11 +0100 |
commit | 8a4b82e3ed75e426d44b69640f009e1e731c75c4 (patch) | |
tree | 4393fcd7681942561dc0ac988d4762682979328f /src/game.cpp | |
parent | c4bdf324d7d464bc7fabbf88e1a6e66701c6e7cb (diff) | |
download | mana-8a4b82e3ed75e426d44b69640f009e1e731c75c4.tar.gz mana-8a4b82e3ed75e426d44b69640f009e1e731c75c4.tar.bz2 mana-8a4b82e3ed75e426d44b69640f009e1e731c75c4.tar.xz mana-8a4b82e3ed75e426d44b69640f009e1e731c75c4.zip |
Prevented looking at item when picking up while moving
+ Fixes from Bjorns review.
Reviewed-by: Bjorn.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/src/game.cpp b/src/game.cpp index 1c24d5d1..7eb2cef1 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -377,29 +377,11 @@ static void handleItemPickUp() int y = local_player->getTileY(); // Let's look for items around until you find one. - bool found = false; - for (int xX = x - 1; xX < x + 2; ++xX) - { - for (int yY = y - 1; yY < y + 2; ++yY) - { - FloorItem *item = actorSpriteManager->findItem(xX, yY); - if (item) - { - found = true; - local_player->pickUp(item); - - // We found it, so set the player - // direction accordingly, - local_player->lookAt( - local_player->getMap()->getTileCenter(xX, yY)); + FloorItem *item = actorSpriteManager->findItem(x, y, 1); + if (!item) + return; - // Get out of the loops - break; - } - } - if (found) - break; - } + local_player->pickUp(item); } /** |