From e40411cdc287343a32a8371f2116fcc11545b466 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 13 Feb 2013 22:58:01 +0300 Subject: Improve event.getId() speed. --- src/gui/itemamountwindow.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/gui/itemamountwindow.cpp') diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index 3ebc899c7..06320e295 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -325,12 +325,13 @@ void ItemAmountWindow::resetAmount() void ItemAmountWindow::action(const gcn::ActionEvent &event) { - if (event.getId() == "cancel") + const std::string &eventId = event.getId(); + if (eventId == "cancel") { close(); return; } - else if (event.getId() == "ok") + else if (eventId == "ok") { if (mItemPriceTextField) { @@ -345,7 +346,7 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event) close(); return; } - else if (event.getId() == "itemType") + else if (eventId == "itemType") { if (!mItemDropDown || !mItemsModal) return; @@ -366,13 +367,13 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event) int amount = mItemAmountTextField->getValue(); - if (event.getId() == "inc" && amount < mMax) + if (eventId == "inc" && amount < mMax) amount++; - else if (event.getId() == "dec" && amount > 1) + else if (eventId == "dec" && amount > 1) amount--; - else if (event.getId() == "all") + else if (eventId == "all") amount = mMax; - else if (event.getId() == "slide") + else if (eventId == "slide") amount = static_cast(mItemAmountSlide->getValue()); mItemAmountTextField->setValue(amount); mItemAmountSlide->setValue(amount); @@ -386,17 +387,17 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event) else if (mPrice < 0) mPrice = 0; - if (event.getId() == "incPrice") + if (eventId == "incPrice") { mPrice++; price = static_cast(pow(10.0, mPrice)); } - else if (event.getId() == "decPrice") + else if (eventId == "decPrice") { mPrice--; price = static_cast(pow(10.0, mPrice)); } - else if (event.getId() == "slidePrice") + else if (eventId == "slidePrice") { price = static_cast(mItemPriceSlide->getValue()); if (price) -- cgit v1.2.3-60-g2f50