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/didyouknowwindow.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/didyouknowwindow.cpp')
-rw-r--r-- | src/gui/didyouknowwindow.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index 54b8c5d88..bd59e8cd3 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -91,17 +91,28 @@ DidYouKnowWindow::DidYouKnowWindow(): void DidYouKnowWindow::action(const gcn::ActionEvent &event) { - if (event.getId() == "close") + const std::string &eventId = event.getId(); + if (eventId == "close") + { setVisible(false); - - const unsigned num = config.getIntValue("currentTip"); - - if (event.getId() == "prev") - loadData(num - 1); - else if (event.getId() == "next") - loadData(num + 1); - else if (event.getId() == "openagain") - config.setValue("showDidYouKnow", mOpenAgainCheckBox->isSelected()); + } + else + { + const unsigned num = config.getIntValue("currentTip"); + if (eventId == "prev") + { + loadData(num - 1); + } + else if (eventId == "next") + { + loadData(num + 1); + } + else if (eventId == "openagain") + { + config.setValue("showDidYouKnow", + mOpenAgainCheckBox->isSelected()); + } + } } void DidYouKnowWindow::handleLink(const std::string &link A_UNUSED, |