summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-18 19:46:23 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-18 21:52:08 +0300
commitc0d5142d1ed98b62ad87603fa9d2620dce256bd7 (patch)
tree6acc4c089999353ef39c83c3bef34bbf89dbfdd3
parente85c6227064c905945a4d49a5e11a0078243a1ac (diff)
downloadmv-c0d5142d1ed98b62ad87603fa9d2620dce256bd7.tar.gz
mv-c0d5142d1ed98b62ad87603fa9d2620dce256bd7.tar.bz2
mv-c0d5142d1ed98b62ad87603fa9d2620dce256bd7.tar.xz
mv-c0d5142d1ed98b62ad87603fa9d2620dce256bd7.zip
add consts in gui classes.
-rw-r--r--src/commandhandler.cpp4
-rw-r--r--src/commandhandler.h24
-rw-r--r--src/gui/botcheckerwindow.cpp2
-rw-r--r--src/gui/buyselldialog.cpp2
-rw-r--r--src/gui/charselectdialog.cpp2
-rw-r--r--src/gui/chatwindow.cpp4
-rw-r--r--src/gui/chatwindow.h2
-rw-r--r--src/gui/focushandler.cpp2
-rw-r--r--src/gui/focushandler.h2
-rw-r--r--src/gui/gui.h4
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/ministatuswindow.cpp5
-rw-r--r--src/gui/selldialog.cpp7
-rw-r--r--src/gui/serverdialog.cpp2
-rw-r--r--src/gui/setup_colors.cpp2
-rw-r--r--src/gui/setup_relations.cpp2
-rw-r--r--src/gui/socialwindow.cpp2
-rw-r--r--src/gui/statuspopup.cpp2
-rw-r--r--src/gui/statuspopup.h2
-rw-r--r--src/gui/tradewindow.cpp2
-rw-r--r--src/gui/tradewindow.h2
-rw-r--r--src/gui/updaterwindow.cpp3
-rw-r--r--src/gui/widgets/battletab.cpp2
-rw-r--r--src/gui/widgets/battletab.h2
-rw-r--r--src/gui/widgets/chattab.cpp4
-rw-r--r--src/gui/widgets/chattab.h2
-rw-r--r--src/gui/widgets/colormodel.cpp6
-rw-r--r--src/gui/widgets/colormodel.h6
-rw-r--r--src/gui/widgets/colorpage.cpp2
-rw-r--r--src/gui/widgets/gmtab.cpp2
-rw-r--r--src/gui/widgets/gmtab.h2
-rw-r--r--src/gui/widgets/guildchattab.cpp2
-rw-r--r--src/gui/widgets/guildchattab.h2
-rw-r--r--src/gui/widgets/horizontcontainer.cpp2
-rw-r--r--src/gui/widgets/horizontcontainer.h2
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp4
-rw-r--r--src/gui/widgets/label.cpp2
-rw-r--r--src/gui/widgets/langtab.cpp2
-rw-r--r--src/gui/widgets/langtab.h2
-rw-r--r--src/gui/widgets/listbox.cpp2
-rw-r--r--src/gui/widgets/popuplist.cpp2
-rw-r--r--src/gui/widgets/popuplist.h2
-rw-r--r--src/gui/widgets/radiogroup.cpp2
-rw-r--r--src/gui/widgets/radiogroup.h2
-rw-r--r--src/gui/widgets/setuptouchitem.cpp4
-rw-r--r--src/gui/widgets/skillinfo.cpp4
-rw-r--r--src/gui/widgets/tabbedarea.cpp4
-rw-r--r--src/gui/widgets/tabbedarea.h4
-rw-r--r--src/gui/widgets/tabstrip.cpp2
-rw-r--r--src/gui/widgets/tabstrip.h2
-rw-r--r--src/gui/widgets/textbox.cpp2
-rw-r--r--src/gui/widgets/tradetab.cpp2
-rw-r--r--src/gui/widgets/tradetab.h2
-rw-r--r--src/gui/widgets/whispertab.cpp2
-rw-r--r--src/gui/widgets/whispertab.h2
-rw-r--r--src/gui/widgets/widgetgroup.h2
-rw-r--r--src/net/ea/gui/guildtab.cpp2
-rw-r--r--src/net/ea/gui/guildtab.h2
-rw-r--r--src/net/ea/gui/partytab.cpp2
-rw-r--r--src/net/ea/gui/partytab.h2
60 files changed, 92 insertions, 85 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index cc16c267f..a66a9d3e1 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -82,7 +82,7 @@ void CommandHandler::handleCommand(const std::string &command,
void CommandHandler::invokeCommand(const std::string &type,
const std::string &args,
ChatTab *const tab,
- const bool warn)
+ const bool warn) const
{
const CommandsMapIter it = mCommands.find(type);
if (it != mCommands.end())
@@ -103,7 +103,7 @@ void CommandHandler::callFunc(const CommandInfo &info,
const std::string &args,
ChatTab *const tab)
{
- CommandFuncPtr func = info.func;
+ const CommandFuncPtr func = info.func;
if (func)
func(args, tab);
else
diff --git a/src/commandhandler.h b/src/commandhandler.h
index 0954d95c2..725434ef7 100644
--- a/src/commandhandler.h
+++ b/src/commandhandler.h
@@ -70,19 +70,19 @@ class CommandHandler final
void invokeCommand(const std::string &type,
const std::string &args,
ChatTab *const tab,
- const bool warn = false);
+ const bool warn = false) const;
- void invokeCommand(const int type);
+ static void invokeCommand(const int type);
- void invokeCommand(const int type,
- const std::string &args,
- ChatTab *const tab);
+ static void invokeCommand(const int type,
+ const std::string &args,
+ ChatTab *const tab);
- void invokeCommand(const int type,
- const std::string &args);
+ static void invokeCommand(const int type,
+ const std::string &args);
- void invokeCommand(const int type,
- ChatTab *const tab);
+ static void invokeCommand(const int type,
+ ChatTab *const tab);
protected:
friend class ChatTab;
@@ -90,9 +90,9 @@ class CommandHandler final
CommandsMap mCommands;
private:
- void callFunc(const CommandInfo &info,
- const std::string &args,
- ChatTab *const tab);
+ static void callFunc(const CommandInfo &info,
+ const std::string &args,
+ ChatTab *const tab);
};
extern CommandHandler *commandHandler;
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index 2ce3a192b..74af1142d 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -231,7 +231,7 @@ public:
signalAfterUpdate();
}
- virtual void updateModelInRow(int row A_UNUSED)
+ virtual void updateModelInRow(const int row A_UNUSED) const
{
}
diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp
index 7a3b92064..13de9c440 100644
--- a/src/gui/buyselldialog.cpp
+++ b/src/gui/buyselldialog.cpp
@@ -75,7 +75,7 @@ void BuySellDialog::init()
int x = buttonPadding;
const int y = buttonPadding;
- for (const char **curBtn = buttonNames; *curBtn; curBtn++)
+ for (const char *const *curBtn = buttonNames; *curBtn; curBtn++)
{
Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this);
if (!mBuyButton)
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index e7f6d9299..1ab2bd0b0 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -384,7 +384,7 @@ void CharSelectDialog::keyPressed(gcn::KeyEvent &keyEvent)
case Input::KEY_GUI_DELETE:
{
keyEvent.consume();
- int idx = mCharacterView->getSelected();
+ const int idx = mCharacterView->getSelected();
if (idx >= 0 && mCharacterEntries[idx]
&& mCharacterEntries[idx]->getCharacter())
{
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index c9690cb86..91cf2417b 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -653,7 +653,7 @@ void ChatWindow::chatInput(const std::string &message) const
Game::instance()->setValidSpeed();
}
-void ChatWindow::localChatInput(const std::string &msg)
+void ChatWindow::localChatInput(const std::string &msg) const
{
if (localChatTab)
localChatTab->chatInput(msg);
@@ -858,7 +858,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
else if (actionId == static_cast<int>(Input::KEY_CHAT_NEXT_HISTORY) &&
mChatInput->isVisible())
{
- ChatTab *const tab = getFocused();
+ const ChatTab *const tab = getFocused();
if (tab && tab->hasRows())
{
const size_t &tabSize = tab->getRows().size();
diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h
index 195c7cba0..ec60846f3 100644
--- a/src/gui/chatwindow.h
+++ b/src/gui/chatwindow.h
@@ -167,7 +167,7 @@ class ChatWindow final : public Window,
*
* @param msg The message text which is to be sent.
*/
- void localChatInput(const std::string &msg);
+ void localChatInput(const std::string &msg) const;
/** Called when key is pressed */
void keyPressed(gcn::KeyEvent &event) override;
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index efe0217d0..d0d4f1280 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -82,7 +82,7 @@ void FocusHandler::tabPrevious()
checkForWindow();
}
-void FocusHandler::checkForWindow()
+void FocusHandler::checkForWindow() const
{
if (mFocusedWidget)
{
diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h
index d1691d965..5965ff5ce 100644
--- a/src/gui/focushandler.h
+++ b/src/gui/focushandler.h
@@ -78,7 +78,7 @@ class FocusHandler final : public gcn::FocusHandler
* Checks to see if the widget tabbed to is in a window, and if it is,
* it requests the window be moved to the top.
*/
- void checkForWindow();
+ void checkForWindow() const;
/**
* Stack of widgets that have requested modal forcus.
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 7742049e3..e82587623 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -154,10 +154,10 @@ class Gui final : public gcn::Gui
void removeDragged(gcn::Widget *widget);
- int getLastMouseX()
+ int getLastMouseX() const
{ return mLastMouseX; }
- int getLastMouseY()
+ int getLastMouseY() const
{ return mLastMouseY; }
protected:
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 4129cc981..7a1645148 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -578,7 +578,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
void InventoryWindow::mouseMoved(gcn::MouseEvent &event)
{
Window::mouseMoved(event);
- gcn::Widget *const src = event.getSource();
+ const gcn::Widget *const src = event.getSource();
if (src == mSlotsBar || src == mWeightBar)
{
const int x = event.getX();
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 1119d2519..5ab8a2b57 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -214,7 +214,7 @@ void MiniStatusWindow::drawIcons(Graphics *const graphics)
int icon_x = mMaxX + mIconPadding;
for (size_t i = 0, sz = mIcons.size(); i < sz; i ++)
{
- AnimatedSprite *const icon = mIcons[i];
+ const AnimatedSprite *const icon = mIcons[i];
if (icon)
{
icon->draw(graphics, icon_x, mIconPadding);
@@ -411,7 +411,8 @@ void MiniStatusWindow::mousePressed(gcn::MouseEvent &event)
if (event.getButton() == gcn::MouseEvent::RIGHT)
{
- ProgressBar *const bar = dynamic_cast<ProgressBar*>(event.getSource());
+ const ProgressBar *const bar = dynamic_cast<ProgressBar*>(
+ event.getSource());
if (!bar)
return;
if (viewport)
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index 63a29d0b1..4d30a742f 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -255,14 +255,19 @@ void SellDialog::action(const gcn::ActionEvent &event)
mMaxItems -= mAmountItems;
while (mAmountItems > 0)
{
+#ifdef MANASERV_SUPPORT
// This order is important, item->getCurrentInvIndex() would
// return the inventory index of the next Duplicate otherwise.
int itemIndex = item->getCurrentInvIndex();
const int sellCount = item->sellCurrentDuplicate(mAmountItems);
-#ifdef MANASERV_SUPPORT
// For Manaserv, the Item id is to be given as index.
if ((Net::getNetworkType() == ServerInfo::MANASERV))
itemIndex = item->getId();
+#else
+ // This order is important, item->getCurrentInvIndex() would
+ // return the inventory index of the next Duplicate otherwise.
+ const int itemIndex = item->getCurrentInvIndex();
+ const int sellCount = item->sellCurrentDuplicate(mAmountItems);
#endif
Net::getNpcHandler()->sellItem(mNpcId, itemIndex, sellCount);
mAmountItems -= sellCount;
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 3257f2a63..d30c995aa 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -629,7 +629,7 @@ void ServerDialog::loadServers(const bool addNew)
version = strprintf(_("requires v%s"), version.c_str());
}
- gcn::Font *const font = gui->getFont();
+ const gcn::Font *const font = gui->getFont();
for_each_xml_child_node(subNode, serverNode)
{
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index f46b94499..16a26a779 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -99,7 +99,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
// TRANSLATORS: color type
std::string longText = _("Static");
- gcn::Font *const font = getFont();
+ const gcn::Font *const font = getFont();
if (getFont()->getWidth(_("Pulse")) > font->getWidth(longText))
{
// TRANSLATORS: color type
diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp
index 812b00159..8a2641ea8 100644
--- a/src/gui/setup_relations.cpp
+++ b/src/gui/setup_relations.cpp
@@ -176,7 +176,7 @@ public:
signalAfterUpdate();
}
- virtual void updateModelInRow(const int row)
+ virtual void updateModelInRow(const int row) const
{
const DropDown *const choicebox = static_cast<DropDown *>(
getElementAt(row, RELATION_CHOICE_COLUMN));
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index a0b41e416..7d03c1441 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -148,7 +148,7 @@ protected:
updateCounter();
}
- void updateCounter()
+ void updateCounter() const
{
if (socialWindow)
socialWindow->setCounter(this, mCounterString);
diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp
index 49f16a944..34d3156d4 100644
--- a/src/gui/statuspopup.cpp
+++ b/src/gui/statuspopup.cpp
@@ -131,7 +131,7 @@ void StatusPopup::setLabelText(const int num,
label->adjustSize();
}
-void StatusPopup::updateLabels()
+void StatusPopup::updateLabels() const
{
if (!player_node || !viewport)
return;
diff --git a/src/gui/statuspopup.h b/src/gui/statuspopup.h
index 01f5c3fbe..f7964741b 100644
--- a/src/gui/statuspopup.h
+++ b/src/gui/statuspopup.h
@@ -58,7 +58,7 @@ class StatusPopup final : public Popup
void update();
private:
- void updateLabels();
+ void updateLabels() const;
void setLabelText(const int num, const std::string &text,
const Input::KeyAction key) const;
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index 5834dcc60..e56b28913 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -258,7 +258,7 @@ void TradeWindow::receivedOk(const bool own)
setStatus(ACCEPTING);
}
-void TradeWindow::tradeItem(Item *const item, const int quantity,
+void TradeWindow::tradeItem(const Item *const item, const int quantity,
const bool check) const
{
if (check && !checkItem(item))
diff --git a/src/gui/tradewindow.h b/src/gui/tradewindow.h
index 11d76eb36..df6d8a80a 100644
--- a/src/gui/tradewindow.h
+++ b/src/gui/tradewindow.h
@@ -102,7 +102,7 @@ class TradeWindow final : public Window,
/**
* Send trade packet.
*/
- void tradeItem(Item *const item, const int quantity,
+ void tradeItem(const Item *const item, const int quantity,
const bool check = false) const;
/**
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index ad4b45ab1..1dc154b23 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -928,7 +928,8 @@ bool UpdaterWindow::validateFile(const std::string &filePath,
unsigned long UpdaterWindow::getFileHash(const std::string &filePath)
{
int size = 0;
- char *buf = static_cast<char*>(ResourceManager::loadFile(filePath, size));
+ char *const buf = static_cast<char*>(ResourceManager::loadFile(
+ filePath, size));
if (!buf)
return 0;
return Net::Download::adlerBuffer(buf, size);
diff --git a/src/gui/widgets/battletab.cpp b/src/gui/widgets/battletab.cpp
index 28081aed4..3f97af5b9 100644
--- a/src/gui/widgets/battletab.cpp
+++ b/src/gui/widgets/battletab.cpp
@@ -41,7 +41,7 @@ BattleTab::~BattleTab()
{
}
-void BattleTab::saveToLogFile(const std::string &msg)
+void BattleTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
chatLogger->log(std::string("#Battle"), std::string(msg));
diff --git a/src/gui/widgets/battletab.h b/src/gui/widgets/battletab.h
index 2377cb591..35a0f1b66 100644
--- a/src/gui/widgets/battletab.h
+++ b/src/gui/widgets/battletab.h
@@ -40,7 +40,7 @@ class BattleTab final : public ChatTab
int getType() const override A_WARN_UNUSED
{ return ChatTab::TAB_BATTLE; }
- void saveToLogFile(const std::string &msg) override;
+ void saveToLogFile(const std::string &msg) const override;
};
extern BattleTab *battleChatTab;
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index f7dd927d2..804da2f18 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -280,7 +280,7 @@ void ChatTab::chatLog(std::string line, Own own,
return;
}
- TabbedArea *const tabArea = getTabbedArea();
+ const TabbedArea *const tabArea = getTabbedArea();
if (!tabArea)
return;
@@ -444,7 +444,7 @@ bool ChatTab::handleCommands(const std::string &type, const std::string &args)
return handleCommand(type, args);
}
-void ChatTab::saveToLogFile(const std::string &msg)
+void ChatTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
{
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 488f9bb2f..8722f894f 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -141,7 +141,7 @@ class ChatTab : public Tab
*/
virtual int getType() const A_WARN_UNUSED;
- virtual void saveToLogFile(const std::string &msg);
+ virtual void saveToLogFile(const std::string &msg) const;
std::list<std::string> &getRows() const A_WARN_UNUSED
{ return mTextOutput->getRows(); }
diff --git a/src/gui/widgets/colormodel.cpp b/src/gui/widgets/colormodel.cpp
index 4a3f15d11..68d31cf81 100644
--- a/src/gui/widgets/colormodel.cpp
+++ b/src/gui/widgets/colormodel.cpp
@@ -48,7 +48,7 @@ std::string ColorModel::getElementAt(int i)
return mNames[i];
}
-ColorPair *ColorModel::getColorAt(int i)
+const ColorPair *ColorModel::getColorAt(const int i) const
{
if (i >= static_cast<int>(mColors.size()) || i < 0)
return nullptr;
@@ -56,8 +56,8 @@ ColorPair *ColorModel::getColorAt(int i)
return &mColors[i];
}
-void ColorModel::add(const std::string &name, const gcn::Color *color1,
- const gcn::Color *color2)
+void ColorModel::add(const std::string &name, const gcn::Color *const color1,
+ const gcn::Color *const color2)
{
mNames.push_back(name);
mColors.push_back(ColorPair(color1, color2));
diff --git a/src/gui/widgets/colormodel.h b/src/gui/widgets/colormodel.h
index 5ce7629a4..aaa988846 100644
--- a/src/gui/widgets/colormodel.h
+++ b/src/gui/widgets/colormodel.h
@@ -55,7 +55,7 @@ class ColorModel : public gcn::ListModel
virtual std::string getElementAt(int i) override A_WARN_UNUSED;
- virtual ColorPair *getColorAt(int i) A_WARN_UNUSED;
+ virtual const ColorPair *getColorAt(const int i) const A_WARN_UNUSED;
StringVect &getNames() A_WARN_UNUSED
{ return mNames; }
@@ -63,8 +63,8 @@ class ColorModel : public gcn::ListModel
size_t size() A_WARN_UNUSED
{ return mNames.size(); }
- void add(const std::string &name, const gcn::Color *color1,
- const gcn::Color *color2);
+ void add(const std::string &name, const gcn::Color *const color1,
+ const gcn::Color *const color2);
static ColorModel *createDefault(const Widget2 *const widget);
diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp
index fb75cf3da..2fb3a50bc 100644
--- a/src/gui/widgets/colorpage.cpp
+++ b/src/gui/widgets/colorpage.cpp
@@ -48,7 +48,7 @@ void ColorPage::draw(gcn::Graphics *graphics)
{
BLOCK_START("ColorPage::draw")
- ColorModel *const model = static_cast<ColorModel* const>(
+ const ColorModel *const model = static_cast<ColorModel* const>(
mListModel);
Graphics *const g = static_cast<Graphics *const>(graphics);
diff --git a/src/gui/widgets/gmtab.cpp b/src/gui/widgets/gmtab.cpp
index 71d59d44a..c8bf8ac98 100644
--- a/src/gui/widgets/gmtab.cpp
+++ b/src/gui/widgets/gmtab.cpp
@@ -51,7 +51,7 @@ void GmTab::handleCommand(const std::string &msg A_UNUSED)
{
}
-void GmTab::saveToLogFile(const std::string &msg)
+void GmTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
chatLogger->log("#GM", msg);
diff --git a/src/gui/widgets/gmtab.h b/src/gui/widgets/gmtab.h
index 64a53b1fc..53e4e9644 100644
--- a/src/gui/widgets/gmtab.h
+++ b/src/gui/widgets/gmtab.h
@@ -38,7 +38,7 @@ class GmTab final : public ChatTab
int getType() const override A_WARN_UNUSED
{ return ChatTab::TAB_GM; }
- void saveToLogFile(const std::string &msg) override;
+ void saveToLogFile(const std::string &msg) const override;
protected:
void getAutoCompleteList(StringVect &names) const override;
diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp
index 4e18eb16a..99723e7e4 100644
--- a/src/gui/widgets/guildchattab.cpp
+++ b/src/gui/widgets/guildchattab.cpp
@@ -134,7 +134,7 @@ void GuildChatTab::getAutoCompleteList(StringVect &names) const
names.push_back("/notice ");
}
-void GuildChatTab::saveToLogFile(const std::string &msg)
+void GuildChatTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
chatLogger->log("#Guild", msg);
diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h
index 03170626b..e60970b50 100644
--- a/src/gui/widgets/guildchattab.h
+++ b/src/gui/widgets/guildchattab.h
@@ -42,7 +42,7 @@ class GuildChatTab final : public ChatTab, public ConfigListener
void showHelp() override;
- void saveToLogFile(const std::string &msg) override;
+ void saveToLogFile(const std::string &msg) const override;
int getType() const override A_WARN_UNUSED
{ return ChatTab::TAB_GUILD; }
diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp
index 9ce676cd5..1d48c7159 100644
--- a/src/gui/widgets/horizontcontainer.cpp
+++ b/src/gui/widgets/horizontcontainer.cpp
@@ -40,7 +40,7 @@ void HorizontContainer::add(gcn::Widget *widget)
add(widget, mSpacing);
}
-void HorizontContainer::add(gcn::Widget *widget, int spacing)
+void HorizontContainer::add(gcn::Widget *const widget, const int spacing)
{
if (!widget)
return;
diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h
index b326c4698..1deb8f3ea 100644
--- a/src/gui/widgets/horizontcontainer.h
+++ b/src/gui/widgets/horizontcontainer.h
@@ -43,7 +43,7 @@ class HorizontContainer final : public Container, public gcn::WidgetListener
void add(gcn::Widget *widget) override;
- void add(gcn::Widget *widget, int spacing);
+ void add(gcn::Widget *const widget, const int spacing);
void clear() override;
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 0a2e61e25..fd70e2032 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -114,7 +114,7 @@ void ItemLinkHandler::handleLink(const std::string &link,
if (!mItemPopup || link.empty())
return;
- char ch = link[0];
+ const char ch = link[0];
if (ch < '0' || ch > '9')
return;
@@ -125,7 +125,7 @@ void ItemLinkHandler::handleLink(const std::string &link,
int color = 1;
if (str.size() > 1)
color = str[1];
- int id = str[0];
+ const int id = str[0];
if (id > 0)
{
const ItemInfo &itemInfo = ItemDB::get(id);
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 90c8f6f66..29bd39af9 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -109,7 +109,7 @@ void Label::draw(gcn::Graphics* graphics)
void Label::adjustSize()
{
- gcn::Font *const font = getFont();
+ const gcn::Font *const font = getFont();
const int pad2 = 2 * mPadding;
setWidth(font->getWidth(mCaption) + pad2);
setHeight(font->getHeight() + pad2);
diff --git a/src/gui/widgets/langtab.cpp b/src/gui/widgets/langtab.cpp
index ddad893b9..1ee4eef75 100644
--- a/src/gui/widgets/langtab.cpp
+++ b/src/gui/widgets/langtab.cpp
@@ -36,7 +36,7 @@ LangTab::~LangTab()
{
}
-void LangTab::saveToLogFile(const std::string &msg)
+void LangTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
chatLogger->log(std::string("#Lang"), std::string(msg));
diff --git a/src/gui/widgets/langtab.h b/src/gui/widgets/langtab.h
index e4359a9e5..0a0ff48c3 100644
--- a/src/gui/widgets/langtab.h
+++ b/src/gui/widgets/langtab.h
@@ -35,7 +35,7 @@ class LangTab final : public ChatTab
int getType() const override A_WARN_UNUSED
{ return ChatTab::TAB_LANG; }
- void saveToLogFile(const std::string &msg) override;
+ void saveToLogFile(const std::string &msg) const override;
};
extern LangTab *langChatTab;
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index f5b926ad7..0889bac15 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -57,7 +57,7 @@ ListBox::ListBox(const Widget2 *const widget,
Theme *const theme = Theme::instance();
if (theme)
- mSkin = Theme::instance()->load(skin, "listbox.xml");
+ mSkin = theme->load(skin, "listbox.xml");
if (mSkin)
mPadding = mSkin->getPadding();
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index 452dfe1b4..3b382f38a 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -105,7 +105,7 @@ int PopupList::getSelected() const
return mListBox->getSelected();
}
-void PopupList::setListModel(gcn::ListModel *model)
+void PopupList::setListModel(gcn::ListModel *const model)
{
if (mListBox)
mListBox->setListModel(model);
diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h
index 9f84b454a..1ffb2d74c 100644
--- a/src/gui/widgets/popuplist.h
+++ b/src/gui/widgets/popuplist.h
@@ -52,7 +52,7 @@ class PopupList final : public Popup,
int getSelected() const;
- void setListModel(gcn::ListModel *model);
+ void setListModel(gcn::ListModel *const model);
gcn::ListModel *getListModel() const
{ return mListModel; }
diff --git a/src/gui/widgets/radiogroup.cpp b/src/gui/widgets/radiogroup.cpp
index 589997660..73d34afce 100644
--- a/src/gui/widgets/radiogroup.cpp
+++ b/src/gui/widgets/radiogroup.cpp
@@ -31,7 +31,7 @@ RadioGroup::RadioGroup(const Widget2 *const widget,
{
}
-gcn::Widget *RadioGroup::createWidget(const std::string &text)
+gcn::Widget *RadioGroup::createWidget(const std::string &text) const
{
RadioButton *const widget = new RadioButton(
this, text, mGroup, mCount == 0);
diff --git a/src/gui/widgets/radiogroup.h b/src/gui/widgets/radiogroup.h
index 60348e4ac..a6c54c15a 100644
--- a/src/gui/widgets/radiogroup.h
+++ b/src/gui/widgets/radiogroup.h
@@ -35,7 +35,7 @@ class RadioGroup final : public WidgetGroup
A_DELETE_COPY(RadioGroup)
gcn::Widget *createWidget(const std::string &name)
- override A_WARN_UNUSED;
+ const override A_WARN_UNUSED;
};
#endif // GUI_WIDGETS_RADIOGROUP_H
diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp
index 739ed07e7..d8d6eda9a 100644
--- a/src/gui/widgets/setuptouchitem.cpp
+++ b/src/gui/widgets/setuptouchitem.cpp
@@ -64,7 +64,7 @@ TouchActionsModel::TouchActionsModel() :
int cnt = 0;
FOR_EACH (std::vector<SetupActionData*>::iterator, it, data)
{
- const SetupActionData *data1 = *it;
+ const SetupActionData *const data1 = *it;
mNames.push_back(data1->name);
mActionId.push_back(data1->actionId);
mActionToSelection[data1->actionId] = cnt;
@@ -81,7 +81,7 @@ int TouchActionsModel::getActionFromSelection(const int sel) const
int TouchActionsModel::getSelectionFromAction(const int action) const
{
- std::map<int, int>::const_iterator it
+ const std::map<int, int>::const_iterator it
= mActionToSelection.find(action);
if (it == mActionToSelection.end())
return 0;
diff --git a/src/gui/widgets/skillinfo.cpp b/src/gui/widgets/skillinfo.cpp
index e49486329..d71b88e85 100644
--- a/src/gui/widgets/skillinfo.cpp
+++ b/src/gui/widgets/skillinfo.cpp
@@ -122,7 +122,7 @@ void SkillInfo::addData(const int level1, SkillData *const data1)
SkillData *SkillInfo::getData(const int level1) const
{
- SkillDataMapCIter it = dataMap.find(level1);
+ const SkillDataMapCIter it = dataMap.find(level1);
if (it == dataMap.end())
return nullptr;
return (*it).second;
@@ -130,7 +130,7 @@ SkillData *SkillInfo::getData(const int level1) const
SkillData *SkillInfo::getData1(const int lev) const
{
- SkillDataMapCIter it = dataMap.find(lev);
+ const SkillDataMapCIter it = dataMap.find(lev);
if (it == dataMap.end())
return (*dataMap.begin()).second;
return (*it).second;
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index acb638889..a08b8430e 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -230,7 +230,7 @@ bool TabbedArea::isTabSelected(const unsigned int index) const
return mSelectedTab == mTabs[index].first;
}
-bool TabbedArea::isTabSelected(Tab *const tab) const
+bool TabbedArea::isTabSelected(const Tab *const tab) const
{
return mSelectedTab == tab;
}
@@ -627,7 +627,7 @@ gcn::Widget *TabbedArea::getWidgetByIndex(const int index) const
return mTabs[index].second;
}
-void TabbedArea::removeAll(bool del)
+void TabbedArea::removeAll(const bool del)
{
if (getSelectedTabIndex() != -1)
{
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index 034257e8f..dd74405fc 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -100,14 +100,14 @@ class TabbedArea final : public Widget2,
bool isTabSelected(const unsigned int index) const A_WARN_UNUSED;
- bool isTabSelected(Tab *const tab) const A_WARN_UNUSED;
+ bool isTabSelected(const Tab *const tab) const A_WARN_UNUSED;
/**
* Overload the remove tab function as it's broken in guichan 0.8.
*/
void removeTab(Tab *const tab);
- void removeAll(bool del = true);
+ void removeAll(const bool del = true);
/**
* Overload the logic function since it's broken in guichan 0.8.
diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp
index d0d0ae4b8..8efd7002f 100644
--- a/src/gui/widgets/tabstrip.cpp
+++ b/src/gui/widgets/tabstrip.cpp
@@ -37,7 +37,7 @@ TabStrip::TabStrip(const Widget2 *const widget,
{
}
-gcn::Widget *TabStrip::createWidget(const std::string &text)
+gcn::Widget *TabStrip::createWidget(const std::string &text) const
{
Button *const widget = new Button(this);
widget->setStick(true);
diff --git a/src/gui/widgets/tabstrip.h b/src/gui/widgets/tabstrip.h
index ed812bc9f..0873290b5 100644
--- a/src/gui/widgets/tabstrip.h
+++ b/src/gui/widgets/tabstrip.h
@@ -38,7 +38,7 @@ class TabStrip final : public WidgetGroup
A_DELETE_COPY(TabStrip)
gcn::Widget *createWidget(const std::string &name)
- override A_WARN_UNUSED;
+ const override A_WARN_UNUSED;
void action(const gcn::ActionEvent &event) override;
};
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 53f071d3d..bf79f80ba 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -87,7 +87,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension)
text.substr(lastNewlinePos, newlinePos - lastNewlinePos);
size_t lastSpacePos = 0;
xpos = 0;
- gcn::Font *const font = getFont();
+ const gcn::Font *const font = getFont();
const int spaceWidth = font->getWidth(" ");
size_t sz = line.size();
diff --git a/src/gui/widgets/tradetab.cpp b/src/gui/widgets/tradetab.cpp
index fbb36f94a..f266f1c8c 100644
--- a/src/gui/widgets/tradetab.cpp
+++ b/src/gui/widgets/tradetab.cpp
@@ -44,7 +44,7 @@ void TradeTab::handleInput(const std::string &msg)
ChatTab::handleInput(str);
}
-void TradeTab::saveToLogFile(const std::string &msg)
+void TradeTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
chatLogger->log(std::string("#Trade"), std::string(msg));
diff --git a/src/gui/widgets/tradetab.h b/src/gui/widgets/tradetab.h
index 01b6b0946..6948a81ff 100644
--- a/src/gui/widgets/tradetab.h
+++ b/src/gui/widgets/tradetab.h
@@ -40,7 +40,7 @@ class TradeTab final : public ChatTab
int getType() const override A_WARN_UNUSED
{ return ChatTab::TAB_TRADE; }
- void saveToLogFile(const std::string &msg) override;
+ void saveToLogFile(const std::string &msg) const override;
protected:
void handleInput(const std::string &msg) override;
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index b836ee729..01298880e 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -163,7 +163,7 @@ bool WhisperTab::handleCommand(const std::string &type,
return true;
}
-void WhisperTab::saveToLogFile(const std::string &msg)
+void WhisperTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
chatLogger->log(getNick(), msg);
diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h
index a28bd4a2e..599350c90 100644
--- a/src/gui/widgets/whispertab.h
+++ b/src/gui/widgets/whispertab.h
@@ -44,7 +44,7 @@ class WhisperTab final : public ChatTab
int getType() const override A_WARN_UNUSED
{ return ChatTab::TAB_WHISPER; }
- void saveToLogFile(const std::string &msg) override;
+ void saveToLogFile(const std::string &msg) const override;
void setWhisperTabColors();
diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h
index b7ec6bd29..55507f316 100644
--- a/src/gui/widgets/widgetgroup.h
+++ b/src/gui/widgets/widgetgroup.h
@@ -54,7 +54,7 @@ class WidgetGroup : public Container,
void widgetResized(const gcn::Event &event) override;
virtual Widget *createWidget(const std::string &name)
- A_WARN_UNUSED = 0;
+ const A_WARN_UNUSED = 0;
protected:
int mSpacing;
diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp
index 1cfdd7b90..86f0e65a6 100644
--- a/src/net/ea/gui/guildtab.cpp
+++ b/src/net/ea/gui/guildtab.cpp
@@ -155,7 +155,7 @@ void GuildTab::getAutoCompleteList(StringVect &names) const
names.push_back("/notice ");
}
-void GuildTab::saveToLogFile(const std::string &msg)
+void GuildTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
chatLogger->log("#Guild", msg);
diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h
index 1fe57437d..f5230615f 100644
--- a/src/net/ea/gui/guildtab.h
+++ b/src/net/ea/gui/guildtab.h
@@ -45,7 +45,7 @@ class GuildTab : public ChatTab, public ConfigListener
void showHelp() override;
- void saveToLogFile(const std::string &msg) override;
+ void saveToLogFile(const std::string &msg) const override;
int getType() const override A_WARN_UNUSED
{ return ChatTab::TAB_GUILD; }
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index 5cca1d54a..2b93793d3 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -275,7 +275,7 @@ void PartyTab::getAutoCompleteList(StringVect &names) const
p->getNames(names);
}
-void PartyTab::saveToLogFile(const std::string &msg)
+void PartyTab::saveToLogFile(const std::string &msg) const
{
if (chatLogger)
chatLogger->log("#Party", msg);
diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h
index 1988df4e8..0f6613094 100644
--- a/src/net/ea/gui/partytab.h
+++ b/src/net/ea/gui/partytab.h
@@ -48,7 +48,7 @@ class PartyTab : public ChatTab, public ConfigListener
int getType() const override A_WARN_UNUSED
{ return ChatTab::TAB_PARTY; }
- void saveToLogFile(const std::string &msg) override;
+ void saveToLogFile(const std::string &msg) const override;
void playNewMessageSound() const override;