summaryrefslogtreecommitdiff
path: root/src/gui/shopwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-13 22:58:01 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-14 01:42:53 +0300
commite40411cdc287343a32a8371f2116fcc11545b466 (patch)
tree4655f02211f1b08b8ead94175fd419c6e766f9c8 /src/gui/shopwindow.cpp
parent2ebce73d5018945bb5f5363913a4096e04bf5a0f (diff)
downloadmv-e40411cdc287343a32a8371f2116fcc11545b466.tar.gz
mv-e40411cdc287343a32a8371f2116fcc11545b466.tar.bz2
mv-e40411cdc287343a32a8371f2116fcc11545b466.tar.xz
mv-e40411cdc287343a32a8371f2116fcc11545b466.zip
Improve event.getId() speed.
Diffstat (limited to 'src/gui/shopwindow.cpp')
-rw-r--r--src/gui/shopwindow.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index c9a64d938..d2cb0f0ea 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -188,55 +188,56 @@ ShopWindow::~ShopWindow()
void ShopWindow::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "close")
+ const std::string &eventId = event.getId();
+ if (eventId == "close")
{
close();
return;
}
- if (event.getId() == "yes")
+ if (eventId == "yes")
{
startTrade();
}
- else if (event.getId() == "no")
+ else if (eventId == "no")
{
mTradeNick.clear();
}
- else if (event.getId() == "ignore")
+ else if (eventId == "ignore")
{
player_relations.ignoreTrade(mTradeNick);
mTradeNick.clear();
}
- else if (event.getId() == "delete buy" && mBuyShopItemList
+ else if (eventId == "delete buy" && mBuyShopItemList
&& mBuyShopItemList->getSelected() >= 0)
{
mBuyShopItems->del(mBuyShopItemList->getSelected());
if (isShopEmpty() && player_node)
player_node->updateStatus();
}
- else if (event.getId() == "delete sell" && mSellShopItemList
+ else if (eventId == "delete sell" && mSellShopItemList
&& mSellShopItemList->getSelected() >= 0)
{
mSellShopItems->del(mSellShopItemList->getSelected());
if (isShopEmpty() && player_node)
player_node->updateStatus();
}
- else if (event.getId() == "announce buy" && mBuyShopItems
+ else if (eventId == "announce buy" && mBuyShopItems
&& mBuyShopItems->getNumberOfElements() > 0)
{
announce(mBuyShopItems, BUY);
}
- else if (event.getId() == "announce sell" && mSellShopItems
+ else if (eventId == "announce sell" && mSellShopItems
&& mSellShopItems->getNumberOfElements() > 0)
{
announce(mSellShopItems, SELL);
}
- else if (event.getId() == "auction buy" && mBuyShopItems
+ else if (eventId == "auction buy" && mBuyShopItems
&& mBuyShopItems->getNumberOfElements() > 0)
{
Net::getChatHandler()->privateMessage("AuctionBot", "!pull4144 seek");
}
- else if (event.getId() == "auction sell" && mSellShopItems
+ else if (eventId == "auction sell" && mSellShopItems
&& mSellShopItems->getNumberOfElements() > 0)
{
Net::getChatHandler()->privateMessage("AuctionBot", "!pull4144 offer");
@@ -253,12 +254,12 @@ void ShopWindow::action(const gcn::ActionEvent &event)
Item *const item = inv->findItem(mSelectedItem, 0);
if (item)
{
- if (event.getId() == "add buy")
+ if (eventId == "add buy")
{
ItemAmountWindow::showWindow(ItemAmountWindow::ShopBuyAdd,
this, item, sumAmount(item));
}
- else if (event.getId() == "add sell")
+ else if (eventId == "add sell")
{
ItemAmountWindow::showWindow(ItemAmountWindow::ShopSellAdd,
this, item, sumAmount(item));