summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-08 23:37:30 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-08 23:37:30 +0200
commit958b06cd741311d42c03c6b91c64ea01c713f516 (patch)
treeb309d316087f85cdf57d266bf678f9923007899b /src
parentee1a1c0e14058fb1a31904a6e2cf0c0ce90bc26b (diff)
downloadmv-958b06cd741311d42c03c6b91c64ea01c713f516.tar.gz
mv-958b06cd741311d42c03c6b91c64ea01c713f516.tar.bz2
mv-958b06cd741311d42c03c6b91c64ea01c713f516.tar.xz
mv-958b06cd741311d42c03c6b91c64ea01c713f516.zip
Replace also color constants in pickup messages.
Diffstat (limited to 'src')
-rw-r--r--src/flooritem.h3
-rw-r--r--src/gui/popupmenu.cpp31
-rw-r--r--src/localplayer.cpp16
-rw-r--r--src/localplayer.h2
-rw-r--r--src/net/tmwa/inventoryhandler.cpp7
5 files changed, 48 insertions, 11 deletions
diff --git a/src/flooritem.h b/src/flooritem.h
index f1d19b89f..3e2f8ef47 100644
--- a/src/flooritem.h
+++ b/src/flooritem.h
@@ -80,6 +80,9 @@ class FloorItem : public ActorSprite
unsigned getPickupCount() const
{ return mPickupCount; }
+ unsigned char getColor() const
+ { return mColor; }
+
private:
int mItemId;
int mX, mY;
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 799b61374..4c970ed19 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -388,9 +388,14 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem)
mFloorItem = floorItem;
ItemInfo info = floorItem->getInfo();
mBrowserBox->clearRows();
+ std::string name;
// Floor item can be picked up (single option, candidate for removal)
- std::string name = info.getName();
+ if (serverVersion > 0)
+ name = info.getName(floorItem->getColor());
+ else
+ name = info.getName();
+
mBrowserBox->addRow(name);
mBrowserBox->addRow(_("@@pickup|Pick up@@"));
mBrowserBox->addRow(_("@@chat|Add to chat@@"));
@@ -821,9 +826,29 @@ void PopupMenu::handleLink(const std::string &link,
if (chatWindow)
{
if (mItem)
- chatWindow->addItemText(mItem->getInfo().getName());
+ {
+ if (serverVersion > 0)
+ {
+ chatWindow->addItemText(mItem->getInfo().getName(
+ mItem->getColor()));
+ }
+ else
+ {
+ chatWindow->addItemText(mItem->getInfo().getName());
+ }
+ }
else if (mFloorItem)
- chatWindow->addItemText(mFloorItem->getInfo().getName());
+ {
+ if (serverVersion > 0)
+ {
+ chatWindow->addItemText(mFloorItem->getInfo().getName(
+ mFloorItem->getColor()));
+ }
+ else
+ {
+ chatWindow->addItemText(mFloorItem->getInfo().getName());
+ }
+ }
}
}
else if (link == "whisper" && !mNick.empty() && chatWindow)
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index a7fa5155a..3bd075f45 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1310,7 +1310,7 @@ void LocalPlayer::stopAttack()
}
void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount,
- unsigned char fail)
+ unsigned char color, unsigned char fail)
{
if (fail)
{
@@ -1346,13 +1346,20 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount,
}
else
{
+ std::string str;
+ if (serverVersion > 0)
+ str = itemInfo.getName(color);
+ else
+ str = itemInfo.getName();
+
if (config.getBoolValue("showpickupchat") && localChatTab)
{
// TRANSLATORS: This sentence may be translated differently
// for different grammatical numbers (singular, plural, ...)
+
localChatTab->chatLog(strprintf(ngettext("You picked up %d "
"[@@%d|%s@@].", "You picked up %d [@@%d|%s@@].", amount),
- amount, itemInfo.getId(), itemInfo.getName().c_str()),
+ amount, itemInfo.getId(), str.c_str()),
BY_SERVER);
}
@@ -1362,12 +1369,11 @@ void LocalPlayer::pickedUp(const ItemInfo &itemInfo, int amount,
if (amount > 1)
{
addMessageToQueue(strprintf("%d x %s", amount,
- itemInfo.getName().c_str()), UserPalette::PICKUP_INFO);
+ str.c_str()), UserPalette::PICKUP_INFO);
}
else
{
- addMessageToQueue(itemInfo.getName(),
- UserPalette::PICKUP_INFO);
+ addMessageToQueue(str, UserPalette::PICKUP_INFO);
}
}
}
diff --git a/src/localplayer.h b/src/localplayer.h
index 22643161c..4d177a23b 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -211,7 +211,7 @@ class LocalPlayer : public Being, public ActorSpriteListener,
* Shows item pickup notifications.
*/
void pickedUp(const ItemInfo &itemInfo, int amount,
- unsigned char fail);
+ unsigned char color, unsigned char fail);
int getLevel() const;
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index afec336c7..203edaa26 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -291,12 +291,15 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
if (err)
{
if (player_node)
- player_node->pickedUp(itemInfo, 0, err);
+ player_node->pickedUp(itemInfo, 0, identified, err);
}
else
{
if (player_node)
- player_node->pickedUp(itemInfo, amount, PICKUP_OKAY);
+ {
+ player_node->pickedUp(itemInfo, amount,
+ identified, PICKUP_OKAY);
+ }
if (inventory)
{