summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2011-02-17 20:32:49 -0800
committerAndrei Karas <akaras@inbox.ru>2011-02-18 18:26:33 +0200
commit0b10f0318b9f9ab308f04712698aa104bec21e29 (patch)
tree5280374e729cc8950fba3301a60fdce4cb727074 /src/localplayer.cpp
parent8329553a5342b1b3b6d81892199c124db0967fc4 (diff)
downloadmv-0b10f0318b9f9ab308f04712698aa104bec21e29.tar.gz
mv-0b10f0318b9f9ab308f04712698aa104bec21e29.tar.bz2
mv-0b10f0318b9f9ab308f04712698aa104bec21e29.tar.xz
mv-0b10f0318b9f9ab308f04712698aa104bec21e29.zip
Specific messages for each pickup failure reason.
Reviewed-by: Jaxad0127 Manaplus: fix code style and add some checks.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index e58ec63ba..1fadc51c1 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1308,20 +1308,39 @@ void LocalPlayer::stopAttack()
mLastTarget = -1;
}
-void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount)
+void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount,
+ unsigned char fail)
{
- if (!amount)
+ if (fail)
{
- if (config.getBoolValue("showpickupchat"))
+ const char* msg;
+ switch (fail)
{
- localChatTab->chatLog(_("Unable to pick up item."),
- BY_SERVER);
+ 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 (mMap && config.getValue("showpickupparticle", 0))
+ if (config.getBoolValue("showpickupchat"))
+ localChatTab->chatLog(_(msg), BY_SERVER);
+
+ if (mMap && config.getBoolValue("showpickupparticle"))
{
// Show pickup notification
- addMessageToQueue(_("Unable to pick up item."),
- UserPalette::PICKUP_INFO);
+ addMessageToQueue(_(msg), UserPalette::PICKUP_INFO);
}
}
else