summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/botcheckerwindow.cpp1
-rw-r--r--src/gui/buyselldialog.cpp5
-rw-r--r--src/gui/changeemaildialog.cpp5
-rw-r--r--src/gui/changepassworddialog.cpp6
-rw-r--r--src/gui/chatwindow.cpp5
-rw-r--r--src/gui/confirmdialog.cpp8
-rw-r--r--src/gui/didyouknowwindow.cpp31
-rw-r--r--src/gui/inventorywindow.cpp27
-rw-r--r--src/gui/itemamountwindow.cpp21
-rw-r--r--src/gui/killstats.cpp5
-rw-r--r--src/gui/logindialog.cpp11
-rw-r--r--src/gui/npcdialog.cpp13
-rw-r--r--src/gui/npcpostdialog.cpp5
-rw-r--r--src/gui/okdialog.cpp5
-rw-r--r--src/gui/registerdialog.cpp5
-rw-r--r--src/gui/setup.cpp10
-rw-r--r--src/gui/setup_colors.cpp14
-rw-r--r--src/gui/setup_relations.cpp7
-rw-r--r--src/gui/setup_theme.cpp19
-rw-r--r--src/gui/shopwindow.cpp25
-rw-r--r--src/gui/skilldialog.cpp9
-rw-r--r--src/gui/socialwindow.cpp32
-rw-r--r--src/gui/tradewindow.cpp11
-rw-r--r--src/gui/unregisterdialog.cpp5
-rw-r--r--src/gui/updaterwindow.cpp5
-rw-r--r--src/gui/widgets/setupitem.cpp14
-rw-r--r--src/gui/widgets/sliderlist.cpp5
-rw-r--r--src/gui/widgets/tabbedarea.cpp6
-rw-r--r--src/gui/worldselectdialog.cpp5
-rw-r--r--src/net/ea/tradehandler.cpp5
30 files changed, 175 insertions, 150 deletions
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index 5e2841879..556f77e64 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -377,7 +377,6 @@ void BotCheckerWindow::action(const gcn::ActionEvent &event)
reset();
mNeedUpdate = true;
}
-
}
void BotCheckerWindow::update()
diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp
index 973df6182..e84982737 100644
--- a/src/gui/buyselldialog.cpp
+++ b/src/gui/buyselldialog.cpp
@@ -112,14 +112,15 @@ void BuySellDialog::setVisible(bool visible)
void BuySellDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "Buy")
+ const std::string &eventId = event.getId();
+ if (eventId == "Buy")
{
if (mNpcId != -1)
Net::getNpcHandler()->buy(mNpcId);
else
Net::getBuySellHandler()->requestSellList(mNick);
}
- else if (event.getId() == "Sell")
+ else if (eventId == "Sell")
{
if (mNpcId != -1)
Net::getNpcHandler()->sell(mNpcId);
diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp
index 4d0cd6d25..9b202e046 100644
--- a/src/gui/changeemaildialog.cpp
+++ b/src/gui/changeemaildialog.cpp
@@ -107,11 +107,12 @@ ChangeEmailDialog::~ChangeEmailDialog()
void ChangeEmailDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "cancel")
+ const std::string &eventId = event.getId();
+ if (eventId == "cancel")
{
Client::setState(STATE_CHAR_SELECT);
}
- else if (event.getId() == "change_email")
+ else if (eventId == "change_email")
{
const std::string username = mLoginData->username.c_str();
diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp
index 8b75140eb..5c4fd4ec5 100644
--- a/src/gui/changepassworddialog.cpp
+++ b/src/gui/changepassworddialog.cpp
@@ -85,13 +85,13 @@ ChangePasswordDialog::~ChangePasswordDialog()
void ChangePasswordDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "cancel")
+ const std::string &eventId = event.getId();
+ if (eventId == "cancel")
{
Client::setState(STATE_CHAR_SELECT);
}
- else if (event.getId() == "change_password")
+ else if (eventId == "change_password")
{
-
const std::string username = mLoginData->username.c_str();
const std::string oldPassword = mOldPassField->getText();
const std::string newFirstPass = mFirstPassField->getText();
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 4ff2f5f56..705ef6e61 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -517,7 +517,8 @@ void ChatWindow::defaultTab()
void ChatWindow::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "chatinput")
+ const std::string &eventId = event.getId();
+ if (eventId == "chatinput")
{
std::string message = mChatInput->getText();
@@ -550,7 +551,7 @@ void ChatWindow::action(const gcn::ActionEvent &event)
setVisible(false);
}
}
- else if (event.getId() == ACTION_COLOR_PICKER)
+ else if (eventId == ACTION_COLOR_PICKER)
{
if (mColorPicker)
{
diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp
index 838b1eaf6..e78be195c 100644
--- a/src/gui/confirmdialog.cpp
+++ b/src/gui/confirmdialog.cpp
@@ -106,11 +106,5 @@ void ConfirmDialog::action(const gcn::ActionEvent &event)
{
setActionEventId(event.getId());
distributeActionEvent();
-
- // Can we receive anything else anyway?
- if (event.getId() == "yes" || event.getId() == "no"
- || event.getId() == "ignore")
- {
- scheduleDelete();
- }
+ scheduleDelete();
}
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,
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);
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<int>(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<int>(pow(10.0, mPrice));
}
- else if (event.getId() == "decPrice")
+ else if (eventId == "decPrice")
{
mPrice--;
price = static_cast<int>(pow(10.0, mPrice));
}
- else if (event.getId() == "slidePrice")
+ else if (eventId == "slidePrice")
{
price = static_cast<int>(mItemPriceSlide->getValue());
if (price)
diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp
index d8da5c1e8..d7590d99e 100644
--- a/src/gui/killstats.cpp
+++ b/src/gui/killstats.cpp
@@ -144,7 +144,8 @@ KillStats::~KillStats()
void KillStats::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "reset")
+ const std::string &eventId = event.getId();
+ if (eventId == "reset")
{
mKillCounter = 0;
mExpCounter = 0;
@@ -157,7 +158,7 @@ void KillStats::action(const gcn::ActionEvent &event)
resetTimes();
}
- else if (event.getId() == "timer")
+ else if (eventId == "timer")
{
mKillTimer = 0;
mKillTCounter = 0;
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index 6d349243e..b0015bf46 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -249,17 +249,18 @@ LoginDialog::~LoginDialog()
void LoginDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "login" && canSubmit())
+ const std::string &eventId = event.getId();
+ if (eventId == "login" && canSubmit())
{
prepareUpdate();
mLoginData->registerLogin = false;
Client::setState(STATE_LOGIN_ATTEMPT);
}
- else if (event.getId() == "server")
+ else if (eventId == "server")
{
close();
}
- else if (event.getId() == "register")
+ else if (eventId == "register")
{
if (Net::getLoginHandler()->isRegistrationEnabled())
{
@@ -275,11 +276,11 @@ void LoginDialog::action(const gcn::ActionEvent &event)
confirmDlg->addActionListener(&urlListener);
}
}
- else if (event.getId() == "customhost")
+ else if (eventId == "customhost")
{
mUpdateHostText->setVisible(mCustomUpdateHost->isSelected());
}
- else if (event.getId() == "updateselect")
+ else if (eventId == "updateselect")
{
mCustomUpdateHost->setSelected(false);
mUpdateHostText->setVisible(false);
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index df534c8e0..df253b752 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -270,7 +270,8 @@ void NpcDialog::showCloseButton()
void NpcDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "ok")
+ const std::string &eventId = event.getId();
+ if (eventId == "ok")
{
if (mActionState == NPC_ACTION_NEXT)
{
@@ -330,26 +331,26 @@ void NpcDialog::action(const gcn::ActionEvent &event)
if (!mLogInteraction)
mTextBox->clearRows();
}
- else if (event.getId() == "reset")
+ else if (eventId == "reset")
{
if (mInputState == NPC_INPUT_STRING)
mTextField->setText(mDefaultString);
else if (mInputState == NPC_INPUT_INTEGER)
mIntField->setValue(mDefaultInt);
}
- else if (event.getId() == "inc")
+ else if (eventId == "inc")
{
mIntField->setValue(mIntField->getValue() + 1);
}
- else if (event.getId() == "dec")
+ else if (eventId == "dec")
{
mIntField->setValue(mIntField->getValue() - 1);
}
- else if (event.getId() == "clear")
+ else if (eventId == "clear")
{
clearRows();
}
- else if (event.getId() == "close")
+ else if (eventId == "close")
{
if (mActionState == NPC_ACTION_INPUT)
{
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 5135e56bd..bb5ab3528 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -92,7 +92,8 @@ NpcPostDialog::~NpcPostDialog()
void NpcPostDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "send")
+ const std::string &eventId = event.getId();
+ if (eventId == "send")
{
if (mSender->getText().empty() || mText->getText().empty())
{
@@ -109,7 +110,7 @@ void NpcPostDialog::action(const gcn::ActionEvent &event)
}
setVisible(false);
}
- else if (event.getId() == "cancel")
+ else if (eventId == "cancel")
{
setVisible(false);
}
diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp
index 4e52cc8ab..ae0c4ca4a 100644
--- a/src/gui/okdialog.cpp
+++ b/src/gui/okdialog.cpp
@@ -86,8 +86,5 @@ void OkDialog::action(const gcn::ActionEvent &event)
{
setActionEventId(event.getId());
distributeActionEvent();
-
- // Can we receive anything else anyway?
- if (event.getId() == "ok")
- scheduleDelete();
+ scheduleDelete();
}
diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp
index 53ce9b3d3..27f56d3d5 100644
--- a/src/gui/registerdialog.cpp
+++ b/src/gui/registerdialog.cpp
@@ -168,11 +168,12 @@ RegisterDialog::~RegisterDialog()
void RegisterDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "cancel")
+ const std::string &eventId = event.getId();
+ if (eventId == "cancel")
{
close();
}
- else if (event.getId() == "register" && canSubmit())
+ else if (eventId == "register" && canSubmit())
{
const std::string user = mUserField->getText();
logger->log("RegisterDialog::register Username is %s", user.c_str());
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 69e879b9c..af67129e0 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -148,23 +148,25 @@ void Setup::action(const gcn::ActionEvent &event)
{
if (Game::instance())
Game::instance()->resetAdjustLevel();
- if (event.getId() == "Apply")
+ const std::string &eventId = event.getId();
+
+ if (eventId == "Apply")
{
setVisible(false);
for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::apply));
}
- else if (event.getId() == "Cancel")
+ else if (eventId == "Cancel")
{
doCancel();
}
- else if (event.getId() == "Store")
+ else if (eventId == "Store")
{
if (chatWindow)
chatWindow->saveState();
config.write();
serverConfig.write();
}
- else if (event.getId() == "Reset Windows")
+ else if (eventId == "Reset Windows")
{
// Bail out if this action happens to be activated before the windows
// are created (though it should be disabled then)
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 880c9082e..f52bbb09c 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -194,36 +194,34 @@ Setup_Colors::~Setup_Colors()
void Setup_Colors::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "slider_grad")
+ const std::string &eventId = event.getId();
+ if (eventId == "slider_grad")
{
updateGradType();
updateColor();
return;
}
- if (event.getId() == "slider_graddelay")
+ if (eventId == "slider_graddelay")
{
mGradDelayText->setText(toString(
std::floor(mGradDelaySlider->getValue())));
updateColor();
return;
}
-
- if (event.getId() == "slider_red")
+ if (eventId == "slider_red")
{
mRedText->setText(toString(std::floor(mRedSlider->getValue())));
updateColor();
return;
}
-
- if (event.getId() == "slider_green")
+ if (eventId == "slider_green")
{
mGreenText->setText(toString(std::floor(mGreenSlider->getValue())));
updateColor();
return;
}
-
- if (event.getId() == "slider_blue")
+ if (eventId == "slider_blue")
{
mBlueText->setText(toString(std::floor(mBlueSlider->getValue())));
updateColor();
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 412f67a4c..5387b0aab 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -363,7 +363,8 @@ void Setup_Relations::cancel()
void Setup_Relations::action(const gcn::ActionEvent &event)
{
- if (event.getId() == ACTION_TABLE)
+ const std::string &eventId = event.getId();
+ if (eventId == ACTION_TABLE)
{
// temporarily eliminate ourselves: we are fully aware of this change,
// so there is no need for asynchronous updates. (In fact, thouse
@@ -378,7 +379,7 @@ void Setup_Relations::action(const gcn::ActionEvent &event)
player_relations.addListener(this);
}
- else if (event.getId() == ACTION_DELETE)
+ else if (eventId == ACTION_DELETE)
{
const int player_index = mPlayerTable->getSelectedRow();
@@ -389,7 +390,7 @@ void Setup_Relations::action(const gcn::ActionEvent &event)
player_relations.removePlayer(name);
}
- else if (event.getId() == ACTION_STRATEGY)
+ else if (eventId == ACTION_STRATEGY)
{
PlayerIgnoreStrategy *const s =
(*player_relations.getPlayerIgnoreStrategies())[
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index 74cd91854..f8437b152 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -349,7 +349,8 @@ void Setup_Theme::updateInfo()
void Setup_Theme::action(const gcn::ActionEvent &event)
{
- if (event.getId() == ACTION_THEME)
+ const std::string &eventId = event.getId();
+ if (eventId == ACTION_THEME)
{
if (mThemeDropDown->getSelected() == 0)
mTheme.clear();
@@ -357,11 +358,11 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
mTheme = mThemeDropDown->getSelectedString();
updateInfo();
}
- else if (event.getId() == ACTION_FONT)
+ else if (eventId == ACTION_FONT)
{
mFont = mFontDropDown->getSelectedString();
}
- else if (event.getId() == ACTION_LANG)
+ else if (eventId == ACTION_LANG)
{
const int id = mLangDropDown->getSelected();
if (id < 0 || id >= langs_count)
@@ -369,27 +370,27 @@ void Setup_Theme::action(const gcn::ActionEvent &event)
else
mLang = LANG_NAME[id].value;
}
- else if (event.getId() == ACTION_BOLD_FONT)
+ else if (eventId == ACTION_BOLD_FONT)
{
mBoldFont = mBoldFontDropDown->getSelectedString();
}
- else if (event.getId() == ACTION_PARTICLE_FONT)
+ else if (eventId == ACTION_PARTICLE_FONT)
{
mParticleFont = mParticleFontDropDown->getSelectedString();
}
- else if (event.getId() == ACTION_HELP_FONT)
+ else if (eventId == ACTION_HELP_FONT)
{
mHelpFont = mHelpFontDropDown->getSelectedString();
}
- else if (event.getId() == ACTION_SECURE_FONT)
+ else if (eventId == ACTION_SECURE_FONT)
{
mSecureFont = mSecureFontDropDown->getSelectedString();
}
- else if (event.getId() == ACTION_JAPAN_FONT)
+ else if (eventId == ACTION_JAPAN_FONT)
{
mJapanFont = mJapanFontDropDown->getSelectedString();
}
- else if (event.getId() == ACTION_INFO)
+ else if (eventId == ACTION_INFO)
{
new OkDialog(_("Theme info"), mThemeInfo, DIALOG_OK,
false, true, nullptr, 600);
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));
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 29b9cb3db..053bcbd1b 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -296,7 +296,8 @@ SkillDialog::~SkillDialog()
void SkillDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "inc")
+ const std::string &eventId = event.getId();
+ if (eventId == "inc")
{
const SkillTab *const tab = static_cast<const SkillTab *const>(
mTabs->getSelectedTab());
@@ -306,7 +307,7 @@ void SkillDialog::action(const gcn::ActionEvent &event)
Net::getPlayerHandler()->increaseSkill(info->id);
}
}
- else if (event.getId() == "sel")
+ else if (eventId == "sel")
{
const SkillTab *const tab = static_cast<const SkillTab *const>(
mTabs->getSelectedTab());
@@ -330,7 +331,7 @@ void SkillDialog::action(const gcn::ActionEvent &event)
}
}
}
- else if (event.getId() == "use")
+ else if (eventId == "use")
{
const SkillTab *const tab = static_cast<const SkillTab *const>(
mTabs->getSelectedTab());
@@ -348,7 +349,7 @@ void SkillDialog::action(const gcn::ActionEvent &event)
}
}
}
- else if (event.getId() == "close")
+ else if (eventId == "close")
{
setVisible(false);
}
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index b5a2d74fc..6c74f4397 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -171,7 +171,8 @@ public:
void action(const gcn::ActionEvent &event)
{
- if (event.getId() == "do invite")
+ const std::string &eventId = event.getId();
+ if (eventId == "do invite")
{
std::string name = mInviteDialog->getText();
Net::getGuildHandler()->invite(mGuild->getId(), name);
@@ -184,11 +185,11 @@ public:
}
mInviteDialog = nullptr;
}
- else if (event.getId() == "~do invite")
+ else if (eventId == "~do invite")
{
mInviteDialog = nullptr;
}
- else if (event.getId() == "yes")
+ else if (eventId == "yes")
{
Net::getGuildHandler()->leave(mGuild->getId());
if (localChatTab)
@@ -198,7 +199,7 @@ public:
}
mConfirmDialog = nullptr;
}
- else if (event.getId() == "~yes")
+ else if (eventId == "~yes")
{
mConfirmDialog = nullptr;
}
@@ -345,7 +346,8 @@ public:
void action(const gcn::ActionEvent &event)
{
- if (event.getId() == "do invite")
+ const std::string &eventId = event.getId();
+ if (eventId == "do invite")
{
std::string name = mInviteDialog->getText();
Net::getPartyHandler()->invite(name);
@@ -357,11 +359,11 @@ public:
}
mInviteDialog = nullptr;
}
- else if (event.getId() == "~do invite")
+ else if (eventId == "~do invite")
{
mInviteDialog = nullptr;
}
- else if (event.getId() == "yes")
+ else if (eventId == "yes")
{
Net::getPartyHandler()->leave();
if (localChatTab)
@@ -371,7 +373,7 @@ public:
}
mConfirmDialog = nullptr;
}
- else if (event.getId() == "~yes")
+ else if (eventId == "~yes")
{
mConfirmDialog = nullptr;
}
@@ -1487,7 +1489,7 @@ void SocialWindow::action(const gcn::ActionEvent &event)
mGuildInvited = 0;
mGuildAcceptDialog = nullptr;
}
- else if (event.getId() == "create")
+ else if (eventId == "create")
{
if (Net::getGuildHandler()->isSupported())
{
@@ -1499,17 +1501,17 @@ void SocialWindow::action(const gcn::ActionEvent &event)
showPartyCreate();
}
}
- else if (event.getId() == "invite" && mTabs->getSelectedTabIndex() > -1)
+ else if (eventId == "invite" && mTabs->getSelectedTabIndex() > -1)
{
if (mTabs->getSelectedTab())
static_cast<SocialTab*>(mTabs->getSelectedTab())->invite();
}
- else if (event.getId() == "leave" && mTabs->getSelectedTabIndex() > -1)
+ else if (eventId == "leave" && mTabs->getSelectedTabIndex() > -1)
{
if (mTabs->getSelectedTab())
static_cast<SocialTab*>(mTabs->getSelectedTab())->leave();
}
- else if (event.getId() == "create guild")
+ else if (eventId == "create guild")
{
std::string name = mGuildCreateDialog->getText();
@@ -1528,11 +1530,11 @@ void SocialWindow::action(const gcn::ActionEvent &event)
mGuildCreateDialog = nullptr;
}
- else if (event.getId() == "~create guild")
+ else if (eventId == "~create guild")
{
mGuildCreateDialog = nullptr;
}
- else if (event.getId() == "create party")
+ else if (eventId == "create party")
{
std::string name = mPartyCreateDialog->getText();
@@ -1551,7 +1553,7 @@ void SocialWindow::action(const gcn::ActionEvent &event)
mPartyCreateDialog = nullptr;
}
- else if (event.getId() == "~create party")
+ else if (eventId == "~create party")
{
mPartyCreateDialog = nullptr;
}
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index 64f06f6c8..c5dcfd21f 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -318,8 +318,9 @@ void TradeWindow::action(const gcn::ActionEvent &event)
return;
Item *const item = inventoryWindow->getSelectedItem();
+ const std::string &eventId = event.getId();
- if (event.getId() == "add")
+ if (eventId == "add")
{
if (mStatus != PREPARING)
return;
@@ -345,7 +346,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
setStatus(PREPARING);
}
- else if (event.getId() == "cancel")
+ else if (eventId == "cancel")
{
setVisible(false);
reset();
@@ -353,7 +354,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
Net::getTradeHandler()->cancel();
}
- else if (event.getId() == "ok")
+ else if (eventId == "ok")
{
mMoneyField->setEnabled(false);
mAddButton->setEnabled(false);
@@ -362,13 +363,13 @@ void TradeWindow::action(const gcn::ActionEvent &event)
setStatus(PROPOSING);
Net::getTradeHandler()->confirm();
}
- else if (event.getId() == "trade")
+ else if (eventId == "trade")
{
receivedOk(true);
setStatus(ACCEPTED);
Net::getTradeHandler()->finish();
}
- else if (event.getId() == "money")
+ else if (eventId == "money")
{
if (mStatus != PREPARING)
return;
diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp
index 86243363f..49db5175c 100644
--- a/src/gui/unregisterdialog.cpp
+++ b/src/gui/unregisterdialog.cpp
@@ -95,11 +95,12 @@ UnRegisterDialog::~UnRegisterDialog()
void UnRegisterDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "cancel")
+ const std::string &eventId = event.getId();
+ if (eventId == "cancel")
{
Client::setState(STATE_CHAR_SELECT);
}
- else if (event.getId() == "unregister")
+ else if (eventId == "unregister")
{
const std::string username = mLoginData->username.c_str();
const std::string password = mPasswordField->getText();
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 3c3dfac9e..033bf3ee4 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -240,7 +240,8 @@ void UpdaterWindow::enable()
void UpdaterWindow::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "cancel")
+ const std::string &eventId = event.getId();
+ if (eventId == "cancel")
{
// Register the user cancel
mUserCancel = true;
@@ -251,7 +252,7 @@ void UpdaterWindow::action(const gcn::ActionEvent &event)
mDownloadStatus = UPDATE_ERROR;
}
}
- else if (event.getId() == "play")
+ else if (eventId == "play")
{
Client::setState(STATE_LOAD_DATA);
}
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index efa96136f..d9071aec4 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -324,17 +324,18 @@ void SetupItemTextField::action(const gcn::ActionEvent &event)
if (!mTextField)
return;
- if (event.getId() == mWidget->getActionEventId())
+ const std::string &eventId = event.getId();
+ if (eventId == mWidget->getActionEventId())
{
fromWidget();
}
- else if (event.getId() == mEventName + "_EDIT")
+ else if (eventId == mEventName + "_EDIT")
{
mEditDialog = new EditDialog(mText, mTextField->getText(),
mEventName + "_EDIT_OK");
mEditDialog->addActionListener(this);
}
- else if (event.getId() == mEventName + "_EDIT_OK")
+ else if (eventId == mEventName + "_EDIT_OK")
{
mTextField->setText(mEditDialog->getMsg());
mEditDialog = nullptr;
@@ -449,17 +450,18 @@ void SetupItemIntTextField::action(const gcn::ActionEvent &event)
if (!mTextField)
return;
- if (event.getId() == mWidget->getActionEventId())
+ const std::string &eventId = event.getId();
+ if (eventId == mWidget->getActionEventId())
{
fromWidget();
}
- else if (event.getId() == mEventName + "_EDIT")
+ else if (eventId == mEventName + "_EDIT")
{
mEditDialog = new EditDialog(mText, mTextField->getText(),
mEventName + "_EDIT_OK");
mEditDialog->addActionListener(this);
}
- else if (event.getId() == mEventName + "_EDIT_OK")
+ else if (eventId == mEventName + "_EDIT_OK")
{
mTextField->setValue(atoi(mEditDialog->getMsg().c_str()));
mEditDialog = nullptr;
diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp
index 55cda4d26..70734b707 100644
--- a/src/gui/widgets/sliderlist.cpp
+++ b/src/gui/widgets/sliderlist.cpp
@@ -145,13 +145,14 @@ void SliderList::action(const gcn::ActionEvent &event)
if (!mListModel)
return;
- if (event.getId() == mPrevEventId)
+ const std::string &eventId = event.getId();
+ if (eventId == mPrevEventId)
{
mSelectedIndex --;
if (mSelectedIndex < 0)
mSelectedIndex = mListModel->getNumberOfElements() - 1;
}
- else if (event.getId() == mNextEventId)
+ else if (eventId == mNextEventId)
{
mSelectedIndex ++;
if (mSelectedIndex >= mListModel->getNumberOfElements())
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index b0999fbd4..82f7b82e4 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -524,18 +524,18 @@ void TabbedArea::action(const gcn::ActionEvent& actionEvent)
}
else
{
- if (actionEvent.getId() == "shift_left")
+ const std::string &eventId = actionEvent.getId();
+ if (eventId == "shift_left")
{
if (mTabScrollIndex)
--mTabScrollIndex;
}
- else if (actionEvent.getId() == "shift_right")
+ else if (eventId == "shift_right")
{
if (mTabScrollIndex < mTabs.size() - 1)
++mTabScrollIndex;
}
adjustTabPositions();
-
updateArrowEnableState();
}
}
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index 51d61fa9c..93314ff16 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -125,7 +125,8 @@ WorldSelectDialog::~WorldSelectDialog()
void WorldSelectDialog::action(const gcn::ActionEvent &event)
{
- if (event.getId() == "world")
+ const std::string &eventId = event.getId();
+ if (eventId == "world")
{
mChangeLoginButton->setEnabled(false);
mChooseWorld->setEnabled(false);
@@ -135,7 +136,7 @@ void WorldSelectDialog::action(const gcn::ActionEvent &event)
if (Client::getState() == STATE_WORLD_SELECT)
Client::setState(STATE_WORLD_SELECT_ATTEMPT);
}
- else if (event.getId() == "login")
+ else if (eventId == "login")
{
Client::setState(STATE_PRE_LOGIN);
}
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index cb62ec3bb..01bbeb45e 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -53,9 +53,10 @@ namespace
void action(const gcn::ActionEvent &event)
{
confirmDlg = nullptr;
- if (event.getId() == "ignore")
+ const std::string &eventId = event.getId();
+ if (eventId == "ignore")
player_relations.ignoreTrade(tradePartnerName);
- Net::getTradeHandler()->respond(event.getId() == "yes");
+ Net::getTradeHandler()->respond(eventId == "yes");
}
} listener;
}