diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-02-13 22:58:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-02-14 01:42:53 +0300 |
commit | e40411cdc287343a32a8371f2116fcc11545b466 (patch) | |
tree | 4655f02211f1b08b8ead94175fd419c6e766f9c8 /src/gui/inventorywindow.cpp | |
parent | 2ebce73d5018945bb5f5363913a4096e04bf5a0f (diff) | |
download | manaplus-e40411cdc287343a32a8371f2116fcc11545b466.tar.gz manaplus-e40411cdc287343a32a8371f2116fcc11545b466.tar.bz2 manaplus-e40411cdc287343a32a8371f2116fcc11545b466.tar.xz manaplus-e40411cdc287343a32a8371f2116fcc11545b466.zip |
Improve event.getId() speed.
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r-- | src/gui/inventorywindow.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 5223e033a..9f6fda689 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -257,7 +257,8 @@ InventoryWindow::~InventoryWindow() void InventoryWindow::action(const gcn::ActionEvent &event) { - if (event.getId() == "outfit") + const std::string &eventId = event.getId(); + if (eventId == "outfit") { if (outfitWindow) { @@ -266,7 +267,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event) outfitWindow->requestMoveToTop(); } } - else if (event.getId() == "shop") + else if (eventId == "shop") { if (shopWindow) { @@ -275,7 +276,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event) shopWindow->requestMoveToTop(); } } - else if (event.getId() == "equipment") + else if (eventId == "equipment") { if (equipmentWindow) { @@ -284,11 +285,11 @@ void InventoryWindow::action(const gcn::ActionEvent &event) equipmentWindow->requestMoveToTop(); } } - else if (event.getId() == "close") + else if (eventId == "close") { close(); } - else if (event.getId() == "store") + else if (eventId == "store") { if (!inventoryWindow || !inventoryWindow->isVisible()) return; @@ -300,17 +301,17 @@ void InventoryWindow::action(const gcn::ActionEvent &event) ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, this, item); } - else if (event.getId() == "sort") + else if (eventId == "sort") { mItems->setSortType(mSortDropDown->getSelected()); return; } - else if (event.getId() == "namefilter") + else if (eventId == "namefilter") { mItems->setName(mNameFilter->getText()); mItems->updateMatrix(); } - else if (!event.getId().find("tag_") && mItems) + else if (!eventId.find("tag_") && mItems) { std::string tagName = event.getId().substr(4); mItems->setFilter(ItemDB::getTagId(tagName)); @@ -322,7 +323,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event) if (!item) return; - if (event.getId() == "use") + if (eventId == "use") { if (item->isEquipment()) { @@ -336,7 +337,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event) Net::getInventoryHandler()->useItem(item); } } - if (event.getId() == "equip") + if (eventId == "equip") { if (!item->isEquipment()) { @@ -350,7 +351,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event) Net::getInventoryHandler()->useItem(item); } } - else if (event.getId() == "drop") + else if (eventId == "drop") { if (isStorageActive()) { @@ -372,12 +373,12 @@ void InventoryWindow::action(const gcn::ActionEvent &event) } } } - else if (event.getId() == "split") + else if (eventId == "split") { ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item, (item->getQuantity() - 1)); } - else if (event.getId() == "retrieve") + else if (eventId == "retrieve") { ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, this, item); |