summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-12-29 12:30:46 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-12-29 12:30:46 +0000
commitb32f28d74e9ec5cfe3bc443e2fbffd5de245fd0b (patch)
tree987e6805c3fc00966d1358b0a6a48c42bf1f0ec7
parent41101dbd7f38c7e9898422c755b8eaf379f1d7c1 (diff)
downloadmana-b32f28d74e9ec5cfe3bc443e2fbffd5de245fd0b.tar.gz
mana-b32f28d74e9ec5cfe3bc443e2fbffd5de245fd0b.tar.bz2
mana-b32f28d74e9ec5cfe3bc443e2fbffd5de245fd0b.tar.xz
mana-b32f28d74e9ec5cfe3bc443e2fbffd5de245fd0b.zip
Removed duplicate pick up code
-rw-r--r--ChangeLog2
-rw-r--r--src/game.cpp17
-rw-r--r--src/gui/popupmenu.cpp4
-rw-r--r--src/net/protocol.cpp2
4 files changed, 8 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index eb3efa50..f0c0faa8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2005-12-29 Björn Steinbrink <B.Steinbrink@gmx.de>
+ * src/game.cpp, src/gui/popupmenu.cpp, src/net/protocol.cpp: Remove
+ duplicated code for picking up items as patched by pclouds.
* src/game.cpp, src/gui/gui.cpp, src/gui/gui.h,
src/gui/inventorywindow.cpp, src/gui/popupmenu.h: Added popup support
to the Gui and moved the according code there to get rid of some nasty
diff --git a/src/game.cpp b/src/game.cpp
index ab0e73d9..fb130acc 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -557,13 +557,8 @@ void do_input()
}
if (id)
- {
- // TODO: Remove duplicated code, probably add a
- // pick up command
- MessageOut outMsg;
- outMsg.writeInt16(0x009f);
- outMsg.writeInt32(id);
- }
+ pickUp(id);
+
used = true;
}
break;
@@ -803,12 +798,8 @@ void do_input()
{
Uint32 id = find_floor_item_by_cor(player_node->x, player_node->y);
- if (id != 0)
- {
- MessageOut outMsg;
- outMsg.writeInt16(CMSG_ITEM_PICKUP);
- outMsg.writeInt32(id);
- }
+ if (id)
+ pickUp(id);
}
else if (joy[JOY_BTN2] && action_time)
{
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index b1046553..8d0ace57 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -177,9 +177,7 @@ void PopupMenu::handleLink(const std::string& link)
// Pick Up Floor Item action
else if ((link == "pickup") && mFloorItem != NULL)
{
- MessageOut outMsg;
- outMsg.writeInt16(CMSG_ITEM_PICKUP);
- outMsg.writeInt32(mFloorItem->getId());
+ pickUp(mFloorItem->getId());
}
// Look To action
diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp
index 7a98ffb6..28663827 100644
--- a/src/net/protocol.cpp
+++ b/src/net/protocol.cpp
@@ -93,7 +93,7 @@ void talk(Being *being)
void pickUp(Uint32 floorItemId)
{
MessageOut outMsg;
- outMsg.writeInt16(0x009f);
+ outMsg.writeInt16(CMSG_ITEM_PICKUP);
outMsg.writeInt32(floorItemId);
}