summaryrefslogtreecommitdiff
path: root/src/gui/popupmenu.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-07 20:20:09 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-07 20:20:09 +0300
commit860c60be6c7a925bb4d8db291b771a6044d20308 (patch)
treeddeb0b2bd54a4b66bd699b220050e4f952bb429f /src/gui/popupmenu.cpp
parent6f9d0494f09833e29a05a2c06287fbee73cb7421 (diff)
downloadplus-860c60be6c7a925bb4d8db291b771a6044d20308.tar.gz
plus-860c60be6c7a925bb4d8db291b771a6044d20308.tar.bz2
plus-860c60be6c7a925bb4d8db291b771a6044d20308.tar.xz
plus-860c60be6c7a925bb4d8db291b771a6044d20308.zip
Add getName property to item and flooritem.
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r--src/gui/popupmenu.cpp52
1 files changed, 8 insertions, 44 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index eb57dd845..436fd93b1 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -282,15 +282,8 @@ void PopupMenu::showPopup(int x, int y, std::vector<ActorSprite*> &beings)
else if (actor->getType() == ActorSprite::FLOOR_ITEM)
{
FloorItem *floorItem = static_cast<FloorItem*>(actor);
- const ItemInfo &info = floorItem->getInfo();
- std::string name;
-
- if (serverVersion > 0)
- name = info.getName(floorItem->getColor());
- else
- name = info.getName();
mBrowserBox->addRow(strprintf("@@flooritem_%u|%s >@@",
- actor->getId(), name.c_str()));
+ actor->getId(), floorItem->getName().c_str()));
}
}
mBrowserBox->addRow("##3---");
@@ -383,15 +376,8 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem)
mX = x;
mY = y;
mType = Being::FLOOR_ITEM;
- const ItemInfo &info = floorItem->getInfo();
mBrowserBox->clearRows();
- std::string name;
-
- // Floor item can be picked up (single option, candidate for removal)
- if (serverVersion > 0)
- name = info.getName(floorItem->getColor());
- else
- name = info.getName();
+ std::string name = floorItem->getName();
mNick = name;
mBrowserBox->addRow(name);
@@ -1687,16 +1673,9 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
}
if (config.getBoolValue("enablePickupFilter"))
{
- const ItemInfo &info = item->getInfo();
- std::string name;
-
- if (serverVersion > 0)
- name = info.getName(item->getColor());
- else
- name = info.getName();
- mNick = name;
+ mNick = item->getName();
mBrowserBox->addRow("##3---");
- addPickupFilter(name);
+ addPickupFilter(mNick);
}
mBrowserBox->addRow("chat", _("Add to chat"));
mBrowserBox->addRow("##3---");
@@ -1784,17 +1763,10 @@ void PopupMenu::showItemPopup(int x, int y, Item *item)
if (config.getBoolValue("enablePickupFilter"))
{
- const ItemInfo &info = item->getInfo();
- std::string name;
-
- if (serverVersion > 0)
- name = info.getName(item->getColor());
- else
- name = info.getName();
- mNick = name;
+ mNick = item->getName();
mBrowserBox->addRow("##3---");
- addPickupFilter(name);
+ addPickupFilter(mNick);
}
}
mBrowserBox->addRow("##3---");
@@ -1846,17 +1818,9 @@ void PopupMenu::showDropPopup(int x, int y, Item *item)
mBrowserBox->addRow("chat", _("Add to chat"));
if (config.getBoolValue("enablePickupFilter"))
{
- const ItemInfo &info = item->getInfo();
- std::string name;
-
- if (serverVersion > 0)
- name = info.getName(item->getColor());
- else
- name = info.getName();
- mNick = name;
-
+ mNick = item->getName();
mBrowserBox->addRow("##3---");
- addPickupFilter(name);
+ addPickupFilter(mNick);
}
}
mBrowserBox->addRow("##3---");