summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2011-02-17 20:32:49 -0800
committerJared Adams <jaxad0127@gmail.com>2011-02-17 22:30:20 -0700
commit85bf2ed70685a29b6a47279deeb61905c6d375b0 (patch)
tree8d2ff19afbcda92b49894262752af2ee8c5b289c /src
parentb74616db888fb69b81d49792ca3d68af3bdeaefe (diff)
downloadmana-85bf2ed70685a29b6a47279deeb61905c6d375b0.tar.gz
mana-85bf2ed70685a29b6a47279deeb61905c6d375b0.tar.bz2
mana-85bf2ed70685a29b6a47279deeb61905c6d375b0.tar.xz
mana-85bf2ed70685a29b6a47279deeb61905c6d375b0.zip
Specific messages for each pickup failure reason.
Reviewed-by: Jaxad0127
Diffstat (limited to 'src')
-rw-r--r--src/localplayer.cpp23
-rw-r--r--src/localplayer.h18
-rw-r--r--src/net/tmwa/inventoryhandler.cpp7
3 files changed, 39 insertions, 9 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index cd1bb561..62b45f62 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1239,19 +1239,32 @@ void LocalPlayer::setMoney(int value)
statusWindow->update(StatusWindow::MONEY);
}
-void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount)
+void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount,
+ unsigned char fail)
{
- if (!amount)
+ if (fail)
{
+ const char* msg;
+ switch (fail)
+ {
+ case PICKUP_BAD_ITEM:
+ msg = N_("Tried to pick up nonexistent item."); break;
+ case PICKUP_TOO_HEAVY: msg = N_("Item is too heavy."); break;
+ case PICKUP_TOO_FAR: msg = N_("Item is too far away"); break;
+ case PICKUP_INV_FULL: msg = N_("Inventory is full."); break;
+ case PICKUP_STACK_FULL: msg = N_("Stack is too big."); break;
+ case PICKUP_DROP_STEAL:
+ msg = N_("Item belongs to someone else."); break;
+ default: msg = N_("Unknown problem picking up item."); break;
+ }
if (config.getValue("showpickupchat", 1))
{
- localChatTab->chatLog(_("Unable to pick up item."), BY_SERVER);
+ localChatTab->chatLog(_(msg), BY_SERVER);
}
if (mMap && config.getValue("showpickupparticle", 0))
{
// Show pickup notification
- addMessageToQueue(_("Unable to pick up item."),
- UserPalette::PICKUP_INFO);
+ addMessageToQueue(_(msg), UserPalette::PICKUP_INFO);
}
}
else
diff --git a/src/localplayer.h b/src/localplayer.h
index 7706caeb..8033263b 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -107,6 +107,21 @@ enum
};
/**
+ * Reasons an item can fail to be picked up.
+ */
+enum
+{
+ PICKUP_OKAY,
+ PICKUP_BAD_ITEM,
+ PICKUP_TOO_HEAVY,
+ PICKUP_TOO_FAR,
+ PICKUP_INV_FULL,
+ PICKUP_STACK_FULL,
+ PICKUP_DROP_STEAL,
+};
+
+
+/**
* The local player character.
*/
class LocalPlayer : public Player
@@ -273,7 +288,8 @@ class LocalPlayer : public Player
/**
* Shows item pickup notifications.
*/
- void pickedUp(const ItemInfo &itemInfo, int amount);
+ void pickedUp(const ItemInfo &itemInfo, int amount,
+ unsigned char fail);
int getHp() const
{ return mHp; }
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 3809399d..5e404e6c 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -230,13 +230,14 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
const ItemInfo &itemInfo = ItemDB::get(itemId);
- if (msg.readInt8() > 0)
+ unsigned char err = msg.readInt8();
+ if (err)
{
- player_node->pickedUp(itemInfo, 0);
+ player_node->pickedUp(itemInfo, 0, err);
}
else
{
- player_node->pickedUp(itemInfo, amount);
+ player_node->pickedUp(itemInfo, amount, PICKUP_OKAY);
Item *item = inventory->getItem(index);