summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-27 01:27:11 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-27 01:27:11 +0300
commitde476bb95242e10c833394ef007728072eabe60f (patch)
tree033747127a7ea4e36de42cfc99fcee56ce915bbb
parenta33a8dc48761d7cb2b4c1c468e1e3b188bcbf709 (diff)
downloadplus-de476bb95242e10c833394ef007728072eabe60f.tar.gz
plus-de476bb95242e10c833394ef007728072eabe60f.tar.bz2
plus-de476bb95242e10c833394ef007728072eabe60f.tar.xz
plus-de476bb95242e10c833394ef007728072eabe60f.zip
Add const to more classes.
-rw-r--r--src/gui/chatwindow.cpp130
-rw-r--r--src/gui/chatwindow.h40
-rw-r--r--src/gui/confirmdialog.cpp7
-rw-r--r--src/gui/confirmdialog.h4
-rw-r--r--src/gui/connectiondialog.cpp8
-rw-r--r--src/gui/connectiondialog.h2
-rw-r--r--src/gui/debugwindow.cpp12
-rw-r--r--src/gui/debugwindow.h2
-rw-r--r--src/gui/didyouknowwindow.cpp6
-rw-r--r--src/gui/didyouknowwindow.h2
-rw-r--r--src/gui/editdialog.cpp6
-rw-r--r--src/gui/editdialog.h4
-rw-r--r--src/gui/editserverdialog.cpp17
-rw-r--r--src/gui/editserverdialog.h3
-rw-r--r--src/gui/equipmentwindow.cpp53
-rw-r--r--src/gui/equipmentwindow.h28
-rw-r--r--src/gui/focushandler.cpp2
-rw-r--r--src/gui/gui.cpp26
-rw-r--r--src/gui/gui.h8
-rw-r--r--src/gui/helpwindow.cpp4
-rw-r--r--src/gui/widgets/browserbox.cpp2
-rw-r--r--src/gui/widgets/browserbox.h2
-rw-r--r--src/gui/widgets/chattab.h2
23 files changed, 193 insertions, 177 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 590946c4e..3f87e6d2c 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -76,7 +76,7 @@
class ChatInput : public TextField, public gcn::FocusListener
{
public:
- ChatInput(ChatWindow *window, TabbedArea *tabs):
+ ChatInput(ChatWindow *const window, TabbedArea *const tabs):
TextField("", false),
mWindow(window),
mChatTabs(tabs)
@@ -96,7 +96,7 @@ class ChatInput : public TextField, public gcn::FocusListener
chatWindow->updateVisibility();
}
- void processVisible(bool n)
+ void processVisible(const bool n)
{
if (!mWindow || isVisible() == n)
return;
@@ -332,12 +332,12 @@ void ChatWindow::loadGMCommands()
if (mGMLoaded)
return;
- const char *fileName = "gmcommands.txt";
- ResourceManager *resman = ResourceManager::getInstance();
+ const char *const fileName = "gmcommands.txt";
+ const ResourceManager *const resman = ResourceManager::getInstance();
StringVect list;
resman->loadTextFile(fileName, list);
StringVectCIter it = list.begin();
- StringVectCIter it_end = list.end();
+ const StringVectCIter it_end = list.end();
while (it != it_end)
{
@@ -365,17 +365,17 @@ void ChatWindow::adjustTabSize()
mChatInput->setWidth(area.width - 2 * mChatInput->getFrameSize());
mChatTabs->setWidth(area.width - 2 * mChatTabs->getFrameSize());
- int height = area.height - 2 * mChatTabs->getFrameSize() -
+ const int height = area.height - 2 * mChatTabs->getFrameSize() -
(mChatInput->getHeight() + mChatInput->getFrameSize() * 2);
if (mChatInput->isVisible() || !config.getBoolValue("hideChatInput"))
mChatTabs->setHeight(height);
else
mChatTabs->setHeight(height + mChatInput->getHeight());
- ChatTab *tab = getFocused();
+ const ChatTab *const tab = getFocused();
if (tab)
{
- gcn::Widget *content = tab->mScrollArea;
+ gcn::Widget *const content = tab->mScrollArea;
if (content)
{
content->setSize(mChatTabs->getWidth()
@@ -416,7 +416,7 @@ ChatTab *ChatWindow::getFocused() const
return static_cast<ChatTab*>(mChatTabs->getSelectedTab());
}
-void ChatWindow::clearTab(ChatTab *tab)
+void ChatWindow::clearTab(ChatTab *const tab) const
{
if (tab)
tab->clearText();
@@ -455,16 +455,16 @@ void ChatWindow::nextTab()
mChatTabs->setSelectedTabByPos(tab);
}
-void ChatWindow::closeTab()
+void ChatWindow::closeTab() const
{
if (!mChatTabs)
return;
- int idx = mChatTabs->getSelectedTabIndex();
- Tab *tab = mChatTabs->getTabByIndex(idx);
+ const int idx = mChatTabs->getSelectedTabIndex();
+ Tab *const tab = mChatTabs->getTabByIndex(idx);
if (!tab)
return;
- WhisperTab *whisper = dynamic_cast<WhisperTab*>(tab);
+ WhisperTab *const whisper = dynamic_cast<WhisperTab* const>(tab);
if (!whisper)
return;
@@ -559,12 +559,12 @@ bool ChatWindow::isInputFocused() const
return mChatInput->isFocused();
}
-void ChatWindow::removeTab(ChatTab *tab)
+void ChatWindow::removeTab(ChatTab *const tab)
{
mChatTabs->removeTab(tab);
}
-void ChatWindow::addTab(ChatTab *tab)
+void ChatWindow::addTab(ChatTab *const tab)
{
if (!tab)
return;
@@ -607,7 +607,8 @@ void ChatWindow::ignoreAllWhispers()
iter != mWhispers.end();
++ iter)
{
- WhisperTab *tab = dynamic_cast<WhisperTab*>(iter->second);
+ const WhisperTab *const tab = dynamic_cast<const WhisperTab* const>(
+ iter->second);
if (tab && player_relations.getRelation(tab->getNick())
!= PlayerRelation::IGNORED)
{
@@ -620,7 +621,7 @@ void ChatWindow::ignoreAllWhispers()
}
}
-void ChatWindow::chatInput(const std::string &message)
+void ChatWindow::chatInput(const std::string &message) const
{
ChatTab *tab = nullptr;
std::string msg = message;
@@ -650,7 +651,7 @@ void ChatWindow::localChatInput(const std::string &msg)
chatInput(msg);
}
-void ChatWindow::doPresent()
+void ChatWindow::doPresent() const
{
if (!actorSpriteManager)
return;
@@ -678,12 +679,12 @@ void ChatWindow::doPresent()
getFocused()->chatLog(log, BY_SERVER);
}
-void ChatWindow::scroll(int amount)
+void ChatWindow::scroll(const int amount) const
{
if (!isVisible())
return;
- ChatTab *tab = getFocused();
+ ChatTab *const tab = getFocused();
if (tab)
tab->scroll(amount);
}
@@ -694,10 +695,10 @@ void ChatWindow::mousePressed(gcn::MouseEvent &event)
{
if (viewport)
{
- gcn::Tab *tab = mChatTabs->getSelectedTab();
+ gcn::Tab *const tab = mChatTabs->getSelectedTab();
if (tab)
{
- ChatTab *cTab = dynamic_cast<ChatTab*>(tab);
+ ChatTab *const cTab = dynamic_cast<ChatTab*>(tab);
if (cTab)
viewport->showChatPopup(cTab);
}
@@ -711,7 +712,7 @@ void ChatWindow::mousePressed(gcn::MouseEvent &event)
if (event.getButton() == gcn::MouseEvent::LEFT)
{
- ChatTab *tab = getFocused();
+ const ChatTab *const tab = getFocused();
if (tab)
mMoved = !isResizeAllowed(event);
}
@@ -753,7 +754,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
if (mCurHist != mHistory.end())
{
// Move forward through the history
- HistoryIterator prevHist = mCurHist++;
+ const HistoryIterator prevHist = mCurHist++;
if (mCurHist != mHistory.end())
{
@@ -804,7 +805,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
else if (actionId == static_cast<int>(Input::KEY_CHAT_PREV_HISTORY) &&
mChatInput->isVisible())
{
- ChatTab *tab = getFocused();
+ const ChatTab *const tab = getFocused();
if (tab && tab->hasRows())
{
if (!mChatHistoryIndex)
@@ -836,7 +837,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
else if (actionId == static_cast<int>(Input::KEY_CHAT_NEXT_HISTORY) &&
mChatInput->isVisible())
{
- ChatTab *tab = getFocused();
+ ChatTab *const tab = getFocused();
if (tab && tab->hasRows())
{
const size_t tabSize = tab->getRows().size();
@@ -934,8 +935,8 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
if (event.getInt("oldValue") > event.getInt("newValue"))
break;
- int change = event.getInt("newValue")
- - event.getInt("oldValue");
+ const int change = event.getInt("newValue")
+ - event.getInt("oldValue");
if (change != 0)
battleChatLog("+" + toString(change) + " xp");
@@ -954,10 +955,10 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
if (!config.getBoolValue("showJobExp"))
return;
- int id = event.getInt("id");
+ const int id = event.getInt("id");
if (id == Net::getPlayerHandler()->getJobLocation())
{
- std::pair<int, int> exp
+ const std::pair<int, int> exp
= PlayerInfo::getStatExperience(
static_cast<PlayerInfo::Attribute>(id));
if (event.getInt("oldValue1") > exp.first
@@ -966,7 +967,7 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
return;
}
- int change = exp.first - event.getInt("oldValue1");
+ const int change = exp.first - event.getInt("oldValue1");
if (change != 0)
battleChatLog("+" + toString(change) + " job");
}
@@ -974,9 +975,9 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
}
}
-void ChatWindow::addInputText(const std::string &text, bool space)
+void ChatWindow::addInputText(const std::string &text, const bool space)
{
- int caretPos = mChatInput->getCaretPosition();
+ const int caretPos = mChatInput->getCaretPosition();
const std::string inputText = mChatInput->getText();
std::ostringstream ss;
@@ -1011,7 +1012,7 @@ void ChatWindow::setVisible(bool visible)
}
void ChatWindow::addWhisper(const std::string &nick,
- const std::string &mes, Own own)
+ const std::string &mes, const Own own)
{
if (mes.empty() || !player_node)
return;
@@ -1026,7 +1027,7 @@ void ChatWindow::addWhisper(const std::string &nick,
return;
ChatTab *tab = nullptr;
- TabMap::const_iterator i = mWhispers.find(tempNick);
+ const TabMap::const_iterator i = mWhispers.find(tempNick);
if (i != mWhispers.end())
{
@@ -1099,7 +1100,8 @@ void ChatWindow::addWhisper(const std::string &nick,
}
}
-ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo)
+ChatTab *ChatWindow::addWhisperTab(const std::string &nick,
+ const bool switchTo)
{
if (!player_node)
return nullptr;
@@ -1110,7 +1112,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick, bool switchTo)
toLower(playerName);
toLower(tempNick);
- TabMap::const_iterator i = mWhispers.find(tempNick);
+ const TabMap::const_iterator i = mWhispers.find(tempNick);
ChatTab *ret;
if (tempNick.compare(playerName) == 0)
@@ -1147,7 +1149,7 @@ ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const
toLower(playerName);
toLower(tempNick);
- TabMap::const_iterator i = mWhispers.find(tempNick);
+ const TabMap::const_iterator i = mWhispers.find(tempNick);
ChatTab *ret = nullptr;
if (tempNick.compare(playerName) == 0)
@@ -1169,7 +1171,7 @@ std::string ChatWindow::addColors(std::string &msg)
}
std::string newMsg("");
- int cMap[] = {1, 4, 5, 2, 3, 6, 7, 9, 0, 8};
+ const int cMap[] = {1, 4, 5, 2, 3, 6, 7, 9, 0, 8};
// rainbow
switch (mChatColor)
@@ -1211,7 +1213,7 @@ std::string ChatWindow::addColors(std::string &msg)
void ChatWindow::autoComplete()
{
- int caretPos = mChatInput->getCaretPosition();
+ const int caretPos = mChatInput->getCaretPosition();
int startName = 0;
const std::string inputText = mChatInput->getText();
bool needSecure(false);
@@ -1231,7 +1233,8 @@ void ChatWindow::autoComplete()
if (caretPos - 1 + 1 == startName)
return;
- ChatTab *cTab = static_cast<ChatTab*>(mChatTabs->getSelectedTab());
+ const ChatTab *const cTab = static_cast<ChatTab*>(
+ mChatTabs->getSelectedTab());
StringVect nameList;
if (cTab)
@@ -1271,8 +1274,8 @@ void ChatWindow::autoComplete()
mChatInput->setText(inputText.substr(0, startName) + newName
+ inputText.substr(caretPos, inputText.length() - caretPos));
- int len = caretPos - static_cast<int>(name.length())
- + static_cast<int>(newName.length());
+ const int len = caretPos - static_cast<int>(name.length())
+ + static_cast<int>(newName.length());
if (startName > 0)
mChatInput->setCaretPosition(len + 1);
@@ -1285,7 +1288,7 @@ std::string ChatWindow::autoComplete(StringVect &names,
std::string partName) const
{
StringVectCIter i = names.begin();
- StringVectCIter i_end = names.end();
+ const StringVectCIter i_end = names.end();
toLower(partName);
std::string newName("");
@@ -1315,13 +1318,14 @@ std::string ChatWindow::autoComplete(StringVect &names,
return newName;
}
-std::string ChatWindow::autoComplete(std::string partName, History *words)
+std::string ChatWindow::autoComplete(std::string partName,
+ History *const words) const
{
if (!words)
return "";
Commands::const_iterator i = words->begin();
- Commands::const_iterator i_end = words->end();
+ const Commands::const_iterator i_end = words->end();
StringVect nameList;
while (i != i_end)
@@ -1350,7 +1354,7 @@ void ChatWindow::moveTabRight(ChatTab *tab)
std::string ChatWindow::autoCompleteHistory(std::string partName)
{
History::const_iterator i = mHistory.begin();
- History::const_iterator i_end = mHistory.end();
+ const History::const_iterator i_end = mHistory.end();
StringVect nameList;
while (i != i_end)
@@ -1370,7 +1374,8 @@ std::string ChatWindow::autoCompleteHistory(std::string partName)
}
void ChatWindow::resortChatLog(std::string line, Own own,
- bool ignoreRecord, bool tryRemoveColors)
+ const bool ignoreRecord,
+ const bool tryRemoveColors)
{
if (own == -1)
own = BY_SERVER;
@@ -1417,7 +1422,8 @@ void ChatWindow::resortChatLog(std::string line, Own own,
}
void ChatWindow::battleChatLog(std::string line, Own own,
- bool ignoreRecord, bool tryRemoveColors)
+ const bool ignoreRecord,
+ const bool tryRemoveColors) const
{
if (own == -1)
own = BY_SERVER;
@@ -1467,7 +1473,7 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
if (!iter->second)
return;
- WhisperTab *tab = static_cast<WhisperTab*>(iter->second);
+ WhisperTab *const tab = static_cast<WhisperTab*>(iter->second);
if (!tab)
continue;
@@ -1481,7 +1487,7 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
const std::string nick = tab->getNick();
if (actorSpriteManager)
{
- const Being *being = actorSpriteManager->findBeingByName(
+ const Being *const being = actorSpriteManager->findBeingByName(
nick, ActorSprite::PLAYER);
if (being)
{
@@ -1491,7 +1497,7 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
}
if (party)
{
- const PartyMember *pm = party->getMember(nick);
+ const PartyMember *const pm = party->getMember(nick);
if (pm && pm->getOnline())
{
tab->setTabColor(&Theme::getThemeColor(Theme::WHISPER));
@@ -1500,7 +1506,7 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
}
if (guild)
{
- const GuildMember *gm = guild->getMember(nick);
+ const GuildMember *const gm = guild->getMember(nick);
if (gm && gm->getOnline())
{
tab->setTabColor(&Theme::getThemeColor(Theme::WHISPER));
@@ -1522,10 +1528,10 @@ void ChatWindow::loadState()
if (nick.empty())
break;
- int flags = serverConfig.getValue(
+ const int flags = serverConfig.getValue(
"chatWhisperFlags" + toString(num), 1);
- ChatTab *tab = addWhisperTab(nick);
+ ChatTab *const tab = addWhisperTab(nick);
if (tab)
{
tab->setAllowHighlight(flags & 1);
@@ -1545,7 +1551,7 @@ void ChatWindow::saveState()
if (!iter->second)
return;
- WhisperTab *tab = static_cast<WhisperTab*>(iter->second);
+ const WhisperTab *const tab = static_cast<WhisperTab*>(iter->second);
if (!tab)
continue;
@@ -1569,7 +1575,7 @@ void ChatWindow::saveState()
}
}
-std::string ChatWindow::doReplace(const std::string &msg)
+std::string ChatWindow::doReplace(const std::string &msg) const
{
std::string str = msg;
replaceSpecialChars(str);
@@ -1619,7 +1625,7 @@ void ChatWindow::displayAwayLog()
return;
std::list<std::string>::iterator i = mAwayLog.begin();
- std::list<std::string>::iterator i_end = mAwayLog.end();
+ const std::list<std::string>::iterator i_end = mAwayLog.end();
while (i != i_end)
{
@@ -1640,18 +1646,18 @@ void ChatWindow::parseHighlights()
mHighlights.push_back(player_node->getName());
}
-bool ChatWindow::findHighlight(std::string &str)
+bool ChatWindow::findHighlight(const std::string &str)
{
return findI(str, mHighlights) != std::string::npos;
}
-void ChatWindow::copyToClipboard(int x, int y)
+void ChatWindow::copyToClipboard(const int x, const int y) const
{
- ChatTab *tab = getFocused();
+ const ChatTab *const tab = getFocused();
if (!tab)
return;
- BrowserBox *text = tab->mTextOutput;
+ const BrowserBox *const text = tab->mTextOutput;
if (!text)
return;
diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h
index 0638d4e7a..66d35ead5 100644
--- a/src/gui/chatwindow.h
+++ b/src/gui/chatwindow.h
@@ -114,7 +114,7 @@ class ChatWindow : public Window,
/**
* Clear the given tab.
*/
- void clearTab(ChatTab *tab);
+ void clearTab(ChatTab *const tab) const;
/**
* Clear the current tab.
@@ -134,7 +134,7 @@ class ChatWindow : public Window,
/**
* Close current chat tab
*/
- void closeTab();
+ void closeTab() const;
/**
* Switch to the default tab
@@ -164,7 +164,7 @@ class ChatWindow : public Window,
*
* @param msg The message text which is to be sent.
*/
- void chatInput(const std::string &msg);
+ void chatInput(const std::string &msg) const;
/**
* Passes the text to the local chat tab as input
@@ -180,7 +180,7 @@ class ChatWindow : public Window,
void setInputText(const std::string &text);
/** Add the given text to the chat input. */
- void addInputText(const std::string &text, bool space = true);
+ void addInputText(const std::string &text, const bool space = true);
/** Called to add item to chat */
void addItemText(const std::string &item);
@@ -207,7 +207,7 @@ class ChatWindow : public Window,
* up, positive numbers scroll down. The absolute amount indicates the
* amount of 1/8ths of chat window real estate that should be scrolled.
*/
- void scroll(int amount);
+ void scroll(const int amount) const;
/**
* Sets the file being recorded to
@@ -219,15 +219,16 @@ class ChatWindow : public Window,
bool getReturnTogglesChat() const
{ return mReturnToggles; }
- void setReturnTogglesChat(bool toggles)
+ void setReturnTogglesChat(const bool toggles)
{ mReturnToggles = toggles; }
- void doPresent();
+ void doPresent() const;
void addWhisper(const std::string &nick, const std::string &mes,
- Own own = BY_OTHER);
+ const Own own = BY_OTHER);
- ChatTab *addWhisperTab(const std::string &nick, bool switchTo = false);
+ ChatTab *addWhisperTab(const std::string &nick,
+ const bool switchTo = false);
ChatTab *getWhisperTab(const std::string &nick) const;
@@ -236,12 +237,12 @@ class ChatWindow : public Window,
void ignoreAllWhispers();
void resortChatLog(std::string line, Own own = BY_UNKNOWN,
- bool ignoreRecord = false,
- bool tryRemoveColors = true);
+ const bool ignoreRecord = false,
+ const bool tryRemoveColors = true);
void battleChatLog(std::string line, Own own = BY_UNKNOWN,
- bool ignoreRecord = false,
- bool tryRemoveColors = true);
+ const bool ignoreRecord = false,
+ const bool tryRemoveColors = true) const;
void updateOnline(std::set<std::string> &onlinePlayers);
@@ -253,7 +254,7 @@ class ChatWindow : public Window,
void loadGMCommands();
- std::string doReplace(const std::string &msg);
+ std::string doReplace(const std::string &msg) const;
void adjustTabSize();
@@ -266,9 +267,9 @@ class ChatWindow : public Window,
void parseHighlights();
- bool findHighlight(std::string &str);
+ bool findHighlight(const std::string &str);
- void copyToClipboard(int x, int y);
+ void copyToClipboard(const int x, const int y) const;
void optionChanged(const std::string &name);
@@ -292,10 +293,10 @@ class ChatWindow : public Window,
typedef std::list<std::string> History;
/** Remove the given tab from the window */
- void removeTab(ChatTab *tab);
+ void removeTab(ChatTab *const tab);
/** Add the tab to the window */
- void addTab(ChatTab *tab);
+ void addTab(ChatTab *const tab);
void removeWhisper(const std::string &nick);
@@ -305,7 +306,8 @@ class ChatWindow : public Window,
std::string autoCompleteHistory(std::string partName);
- std::string autoComplete(std::string partName, History *words);
+ std::string autoComplete(std::string partName,
+ History *const words) const;
std::string autoComplete(StringVect &names,
std::string partName) const;
diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp
index e4531ac3b..b0407572a 100644
--- a/src/gui/confirmdialog.cpp
+++ b/src/gui/confirmdialog.cpp
@@ -36,7 +36,8 @@
#include "debug.h"
ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
- bool ignore, bool modal, Window *parent):
+ const bool ignore, const bool modal,
+ Window *const parent):
Window(title, modal, parent, "confirm.xml")
{
mTextBox = new TextBox;
@@ -44,8 +45,8 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg,
mTextBox->setOpaque(false);
mTextBox->setTextWrapped(msg, 260);
- gcn::Button *yesButton = new Button(_("Yes"), "yes", this);
- gcn::Button *noButton = new Button(_("No"), "no", this);
+ gcn::Button *const yesButton = new Button(_("Yes"), "yes", this);
+ gcn::Button *const noButton = new Button(_("No"), "no", this);
gcn::Button *ignoreButton = nullptr;
if (ignore)
diff --git a/src/gui/confirmdialog.h b/src/gui/confirmdialog.h
index 421be7f96..f87b61282 100644
--- a/src/gui/confirmdialog.h
+++ b/src/gui/confirmdialog.h
@@ -45,8 +45,8 @@ class ConfirmDialog : public Window, public gcn::ActionListener
* @see Window::Window
*/
ConfirmDialog(const std::string &title, const std::string &msg,
- bool ignore = false, bool modal = false,
- Window *parent = nullptr);
+ const bool ignore = false, const bool modal = false,
+ Window *const parent = nullptr);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/connectiondialog.cpp b/src/gui/connectiondialog.cpp
index b5357d83c..872f8ad76 100644
--- a/src/gui/connectiondialog.cpp
+++ b/src/gui/connectiondialog.cpp
@@ -34,7 +34,7 @@
#include "debug.h"
ConnectionDialog::ConnectionDialog(const std::string &text,
- State cancelState):
+ const State cancelState):
Window(""),
mCancelState(cancelState)
{
@@ -42,9 +42,9 @@ ConnectionDialog::ConnectionDialog(const std::string &text,
setMovable(false);
setMinWidth(0);
- ProgressIndicator *progressIndicator = new ProgressIndicator;
- gcn::Label *label = new Label(text);
- Button *cancelButton = new Button(_("Cancel"), "cancelButton", this);
+ ProgressIndicator *const progressIndicator = new ProgressIndicator;
+ gcn::Label *const label = new Label(text);
+ Button *const cancelButton = new Button(_("Cancel"), "cancelButton", this);
place(0, 0, progressIndicator);
place(0, 1, label);
diff --git a/src/gui/connectiondialog.h b/src/gui/connectiondialog.h
index a40f7472c..df836feab 100644
--- a/src/gui/connectiondialog.h
+++ b/src/gui/connectiondialog.h
@@ -45,7 +45,7 @@ class ConnectionDialog : public Window, private gcn::ActionListener
*
* @see Window::Window
*/
- ConnectionDialog(const std::string &text, State cancelState);
+ ConnectionDialog(const std::string &text, const State cancelState);
/**
* Called when the user presses Cancel. Restores the global state to
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index a3b077648..7bcec47ec 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -117,10 +117,10 @@ void DebugWindow::draw(gcn::Graphics *g)
if (player_node)
{
- Being *target = player_node->getTarget();
+ const Being *const target = player_node->getTarget();
if (target)
{
- Graphics *g2 = static_cast<Graphics*>(g);
+ Graphics *const g2 = static_cast<Graphics*>(g);
target->draw(g2, -target->getPixelX() + 16 + getWidth() / 2,
-target->getPixelY() + 32 + getHeight() / 2);
}
@@ -206,13 +206,13 @@ void MapDebugTab::logic()
mXYLabel->setCaption(strprintf("%s (?, ?)", _("Player Position:")));
}
- const Map *map = Game::instance()->getCurrentMap();
+ const Map *const map = Game::instance()->getCurrentMap();
if (map && viewport)
{
// Get the current mouse position
- int mouseTileX = (viewport->getMouseX() + viewport->getCameraX())
+ const int mouseTileX = (viewport->getMouseX() + viewport->getCameraX())
/ map->getTileWidth();
- int mouseTileY = (viewport->getMouseY() + viewport->getCameraY())
+ const int mouseTileY = (viewport->getMouseY() + viewport->getCameraY())
/ map->getTileHeight();
mTileMouseLabel->setCaption(strprintf("%s (%d, %d)",
_("Cursor:"), mouseTileX, mouseTileY));
@@ -297,7 +297,7 @@ void TargetDebugTab::logic()
{
if (player_node && player_node->getTarget())
{
- Being *target = player_node->getTarget();
+ const Being *const target = player_node->getTarget();
mTargetLabel->setCaption(strprintf("%s %s (%d, %d)", _("Target:"),
target->getName().c_str(), target->getTileX(),
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 1a5339cba..c6143dfa1 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -42,7 +42,7 @@ class DebugTab : public Container
void logic() = 0;
- void resize(int x, int y)
+ void resize(const int x, const int y)
{ setDimension(gcn::Rectangle(0, 0, x, y)); }
private:
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp
index 1c30b32ed..c9e372823 100644
--- a/src/gui/didyouknowwindow.cpp
+++ b/src/gui/didyouknowwindow.cpp
@@ -65,7 +65,7 @@ DidYouKnowWindow::DidYouKnowWindow():
mBrowserBox->setOpaque(false);
mScrollArea = new ScrollArea(mBrowserBox,
true, "didyouknow_background.xml");
- Button *okButton = new Button(_("Close"), "close", this);
+ Button *const okButton = new Button(_("Close"), "close", this);
mButtonPrev = new Button(_("< Previous"), "prev", this);
mButtonNext = new Button(_("Next >"), "next", this);
mOpenAgainCheckBox = new CheckBox(_("Auto open this window"),
@@ -93,7 +93,7 @@ void DidYouKnowWindow::action(const gcn::ActionEvent &event)
if (event.getId() == "close")
setVisible(false);
- unsigned num = config.getIntValue("currentTip");
+ const unsigned num = config.getIntValue("currentTip");
if (event.getId() == "prev")
loadData(num - 1);
@@ -124,7 +124,7 @@ void DidYouKnowWindow::loadData(int num)
mScrollArea->setVerticalScrollAmount(0);
}
-void DidYouKnowWindow::loadFile(int num)
+void DidYouKnowWindow::loadFile(const int num)
{
const std::string file = strprintf("tips/%d", num);
std::string helpPath = branding.getStringValue("helpPath");
diff --git a/src/gui/didyouknowwindow.h b/src/gui/didyouknowwindow.h
index de5064ad3..d4452fcd2 100644
--- a/src/gui/didyouknowwindow.h
+++ b/src/gui/didyouknowwindow.h
@@ -65,7 +65,7 @@ class DidYouKnowWindow : public Window, public LinkHandler,
void setVisible(bool visible);
private:
- void loadFile(int num);
+ void loadFile(const int num);
BrowserBox *mBrowserBox;
gcn::ScrollArea *mScrollArea;
diff --git a/src/gui/editdialog.cpp b/src/gui/editdialog.cpp
index 96e6d21b2..f4a71b47e 100644
--- a/src/gui/editdialog.cpp
+++ b/src/gui/editdialog.cpp
@@ -33,8 +33,8 @@
#include "debug.h"
EditDialog::EditDialog(const std::string &title, const std::string &msg,
- std::string eventOk, int width,
- Window *parent, bool modal):
+ std::string eventOk, const int width,
+ Window *const parent, const bool modal):
Window(title, modal, parent, "edit.xml")
{
mTextField = new TextField;
@@ -42,7 +42,7 @@ EditDialog::EditDialog(const std::string &title, const std::string &msg,
mEventOk = eventOk;
- gcn::Button *okButton = new Button(_("OK"), mEventOk, this);
+ gcn::Button *const okButton = new Button(_("OK"), mEventOk, this);
const int numRows = 1;
const int fontHeight = getFont()->getHeight();
diff --git a/src/gui/editdialog.h b/src/gui/editdialog.h
index 206a45079..0e7283b3e 100644
--- a/src/gui/editdialog.h
+++ b/src/gui/editdialog.h
@@ -48,8 +48,8 @@ class EditDialog : public Window, public gcn::ActionListener
* @see Window::Window
*/
EditDialog(const std::string &title, const std::string &msg,
- std::string eventOk = ACTION_EDIT_OK, int width = 300,
- Window *parent = nullptr, bool modal = true);
+ std::string eventOk = ACTION_EDIT_OK, const int width = 300,
+ Window *const parent = nullptr, const bool modal = true);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/editserverdialog.cpp b/src/gui/editserverdialog.cpp
index 9701e2b3d..15f4b8ac8 100644
--- a/src/gui/editserverdialog.cpp
+++ b/src/gui/editserverdialog.cpp
@@ -60,8 +60,9 @@ std::string TypeListModel::getElementAt(int elementIndex)
return "Unknown";
}
-EditServerDialog::EditServerDialog(ServerDialog *parent, ServerInfo server,
- int index) :
+EditServerDialog::EditServerDialog(ServerDialog *const parent,
+ ServerInfo server,
+ const int index) :
Window(_("Edit Server"), true, parent),
mServerDialog(parent),
mServer(server),
@@ -69,11 +70,11 @@ EditServerDialog::EditServerDialog(ServerDialog *parent, ServerInfo server,
{
setWindowName("EditServerDialog");
- Label *nameLabel = new Label(_("Name:"));
- Label *serverAdressLabel = new Label(_("Address:"));
- Label *portLabel = new Label(_("Port:"));
- Label *typeLabel = new Label(_("Server type:"));
- Label *descriptionLabel = new Label(_("Description:"));
+ Label *const nameLabel = new Label(_("Name:"));
+ Label *const serverAdressLabel = new Label(_("Address:"));
+ Label *const portLabel = new Label(_("Port:"));
+ Label *const typeLabel = new Label(_("Server type:"));
+ Label *const descriptionLabel = new Label(_("Description:"));
mServerAddressField = new TextField(std::string());
mPortField = new TextField(std::string());
mPortField->setNumeric(true);
@@ -200,7 +201,7 @@ void EditServerDialog::action(const gcn::ActionEvent &event)
if (mServerAddressField->getText().empty()
|| mPortField->getText().empty())
{
- OkDialog *dlg = new OkDialog(_("Error"),
+ OkDialog *const dlg = new OkDialog(_("Error"),
_("Please at least type both the address and the port "
"of the server."), DIALOG_ERROR);
dlg->addActionListener(this);
diff --git a/src/gui/editserverdialog.h b/src/gui/editserverdialog.h
index 79169c3a3..438529865 100644
--- a/src/gui/editserverdialog.h
+++ b/src/gui/editserverdialog.h
@@ -81,7 +81,8 @@ class EditServerDialog : public Window,
public gcn::KeyListener
{
public:
- EditServerDialog(ServerDialog *parent, ServerInfo server, int index);
+ EditServerDialog(ServerDialog *const parent, ServerInfo server,
+ const int index);
~EditServerDialog();
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 97ccc69f7..2eea0b3be 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -53,8 +53,9 @@ static const int BOX_X_PAD = (BOX_WIDTH - 32) / 2;
static const int BOX_Y_PAD = (BOX_HEIGHT - 32) / 2;
static const int BOX_COUNT = 13;
-EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
- bool foring):
+EquipmentWindow::EquipmentWindow(Equipment *const equipment,
+ Being *const being,
+ const bool foring):
Window(_("Equipment"), false, nullptr, "equipment.xml"),
mEquipment(equipment),
mSelected(-1),
@@ -130,7 +131,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
// Draw window graphics
Window::draw(graphics);
- Graphics *g = static_cast<Graphics*>(graphics);
+ Graphics *const g = static_cast<Graphics*>(graphics);
Window::drawChildren(graphics);
@@ -140,7 +141,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
for (std::vector<EquipmentBox*>::const_iterator it = mBoxes.begin(),
it_end = mBoxes.end(); it != it_end; ++ it, ++ i)
{
- EquipmentBox *box = *it;
+ const EquipmentBox *const box = *it;
if (!box)
continue;
if (i == mSelected)
@@ -161,11 +162,11 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
if (!mEquipment)
continue;
- Item *item = mEquipment->getEquipment(i);
+ const Item *const item = mEquipment->getEquipment(i);
if (item)
{
// Draw Item.
- Image *image = item->getImage();
+ Image *const image = item->getImage();
if (image)
{
image->setAlpha(1.0f); // Ensure the image is drawn
@@ -195,13 +196,13 @@ void EquipmentWindow::action(const gcn::ActionEvent &event)
if (event.getId() == "unequip" && mSelected > -1)
{
- Item *item = mEquipment->getEquipment(mSelected);
+ const Item *const item = mEquipment->getEquipment(mSelected);
Net::getInventoryHandler()->unequipItem(item);
setSelected(-1);
}
}
-Item *EquipmentWindow::getItem(int x, int y) const
+Item *EquipmentWindow::getItem(const int x, const int y) const
{
if (!mEquipment)
return nullptr;
@@ -211,7 +212,7 @@ Item *EquipmentWindow::getItem(int x, int y) const
for (std::vector<EquipmentBox*>::const_iterator it = mBoxes.begin(),
it_end = mBoxes.end(); it != it_end; ++ it, ++ i)
{
- EquipmentBox *box = *it;
+ const EquipmentBox *const box = *it;
if (!box)
continue;
const gcn::Rectangle tRect(box->x, box->y,
@@ -243,10 +244,10 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent)
for (std::vector<EquipmentBox*>::const_iterator it = mBoxes.begin(),
it_end = mBoxes.end(); it != it_end; ++ it, ++ i)
{
- EquipmentBox *box = *it;
+ const EquipmentBox *const box = *it;
if (!box)
continue;
- Item *item = mEquipment->getEquipment(i);
+ const Item *const item = mEquipment->getEquipment(i);
const gcn::Rectangle tRect(box->x, box->y,
BOX_WIDTH, BOX_HEIGHT);
@@ -256,7 +257,7 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent)
}
else if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT)
{
- if (Item *item = getItem(x, y))
+ if (Item *const item = getItem(x, y))
{
if (mItemPopup)
mItemPopup->setVisible(false);
@@ -286,7 +287,7 @@ void EquipmentWindow::mouseMoved(gcn::MouseEvent &event)
const int x = event.getX();
const int y = event.getY();
- Item *item = getItem(x, y);
+ const Item *const item = getItem(x, y);
if (item)
{
@@ -309,14 +310,14 @@ void EquipmentWindow::mouseExited(gcn::MouseEvent &event A_UNUSED)
mItemPopup->setVisible(false);
}
-void EquipmentWindow::setSelected(int index)
+void EquipmentWindow::setSelected(const int index)
{
mSelected = index;
if (mUnequip)
mUnequip->setEnabled(mSelected != -1);
}
-void EquipmentWindow::setBeing(Being *being)
+void EquipmentWindow::setBeing(Being *const being)
{
mPlayerBox->setPlayer(being);
mBeing = being;
@@ -331,13 +332,13 @@ void EquipmentWindow::setBeing(Being *being)
mEquipment = being->getEquipment();
}
-void EquipmentWindow::updateBeing(Being *being)
+void EquipmentWindow::updateBeing(Being *const being)
{
if (being == mBeing)
setBeing(being);
}
-void EquipmentWindow::resetBeing(Being *being)
+void EquipmentWindow::resetBeing(const Being *const being)
{
if (being == mBeing)
setBeing(nullptr);
@@ -346,7 +347,7 @@ void EquipmentWindow::resetBeing(Being *being)
void EquipmentWindow::fillBoxes()
{
XML::Document *doc = new XML::Document("equipmentwindow.xml");
- XmlNodePtr root = doc->rootNode();
+ const XmlNodePtr root = doc->rootNode();
if (!root)
{
delete doc;
@@ -372,13 +373,13 @@ void EquipmentWindow::fillBoxes()
delete doc;
}
-void EquipmentWindow::loadWindow(XmlNodePtr windowNode)
+void EquipmentWindow::loadWindow(const XmlNodePtr windowNode)
{
setDefaultSize(XML::getProperty(windowNode, "width", 180),
XML::getProperty(windowNode, "height", 345), ImageRect::CENTER);
}
-void EquipmentWindow::loadPlayerBox(XmlNodePtr playerBoxNode)
+void EquipmentWindow::loadPlayerBox(const XmlNodePtr playerBoxNode)
{
mPlayerBox->setDimension(gcn::Rectangle(
XML::getProperty(playerBoxNode, "x", 50),
@@ -387,9 +388,10 @@ void EquipmentWindow::loadPlayerBox(XmlNodePtr playerBoxNode)
XML::getProperty(playerBoxNode, "height", 168)));
}
-void EquipmentWindow::loadSlot(XmlNodePtr slotNode, ImageSet *imageset)
+void EquipmentWindow::loadSlot(const XmlNodePtr slotNode,
+ const ImageSet *const imageset)
{
- int slot = parseSlotName(XML::getProperty(slotNode, "name", ""));
+ const int slot = parseSlotName(XML::getProperty(slotNode, "name", ""));
if (slot < 0)
return;
@@ -406,7 +408,7 @@ void EquipmentWindow::loadSlot(XmlNodePtr slotNode, ImageSet *imageset)
if (mBoxes[slot])
{
- EquipmentBox *box = mBoxes[slot];
+ EquipmentBox *const box = mBoxes[slot];
box->x = x;
box->y = y;
box->image = image;
@@ -417,7 +419,7 @@ void EquipmentWindow::loadSlot(XmlNodePtr slotNode, ImageSet *imageset)
}
}
-int EquipmentWindow::parseSlotName(std::string name)
+int EquipmentWindow::parseSlotName(std::string name) const
{
int id = -1;
if (name == "shoes" || name == "boot" || name == "boots")
@@ -500,7 +502,8 @@ void EquipmentWindow::fillDefault()
addBox(12, 129, 123, 5); // ring
}
-void EquipmentWindow::addBox(int idx, int x, int y, int imageIndex)
+void EquipmentWindow::addBox(const int idx, const int x, const int y,
+ const int imageIndex)
{
Image *image = nullptr;
diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h
index a95e98c13..ad90bca12 100644
--- a/src/gui/equipmentwindow.h
+++ b/src/gui/equipmentwindow.h
@@ -51,7 +51,7 @@ namespace gcn
struct EquipmentBox
{
- EquipmentBox(int x0, int y0, Image *img) :
+ EquipmentBox(const int x0, const int y0, Image *const img) :
x(x0), y(y0), image(img)
{ }
@@ -71,8 +71,8 @@ class EquipmentWindow : public Window, public gcn::ActionListener
/**
* Constructor.
*/
- EquipmentWindow(Equipment *equipment, Being *being,
- bool mCloseOnHide = false);
+ EquipmentWindow(Equipment *const equipment, Being *const being,
+ const bool foring = false);
/**
* Destructor.
@@ -91,34 +91,36 @@ class EquipmentWindow : public Window, public gcn::ActionListener
Item* getEquipment(int i) const
{ return mEquipment ? mEquipment->getEquipment(i) : nullptr; }
- void setBeing(Being *being);
+ void setBeing(Being *const being);
- void updateBeing(Being *being);
+ void updateBeing(Being *const being);
- void resetBeing(Being *being);
+ void resetBeing(const Being *const being);
private:
void mouseExited(gcn::MouseEvent &event);
void mouseMoved(gcn::MouseEvent &event);
- Item *getItem(int x, int y) const;
+ Item *getItem(const int x, const int y) const;
- void setSelected(int index);
+ void setSelected(const int index);
void fillBoxes();
void fillDefault();
- void addBox(int idx, int x, int y, int imageIndex);
+ void addBox(const int idx, const int x, const int y,
+ const int imageIndex);
- void loadWindow(XmlNodePtr windowNode);
+ void loadWindow(const XmlNodePtr windowNode);
- void loadPlayerBox(XmlNodePtr playerBoxNode);
+ void loadPlayerBox(const XmlNodePtr playerBoxNode);
- void loadSlot(XmlNodePtr slotNode, ImageSet *imageset);
+ void loadSlot(const XmlNodePtr slotNode,
+ const ImageSet *const imageset);
- int parseSlotName(std::string name);
+ int parseSlotName(std::string name) const;
Equipment *mEquipment;
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index 0e98c3473..ce40c3a7c 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -88,7 +88,7 @@ void FocusHandler::checkForWindow()
while (widget)
{
- Window *window = dynamic_cast<Window*>(widget);
+ Window *const window = dynamic_cast<Window*>(widget);
if (window)
{
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 3020168b7..ae2c38d15 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -58,7 +58,7 @@ SDLFont *boldFont = nullptr;
class GuiConfigListener : public ConfigListener
{
public:
- GuiConfigListener(Gui *g):
+ GuiConfigListener(Gui *const g):
mGui(g)
{}
@@ -66,7 +66,7 @@ class GuiConfigListener : public ConfigListener
{
if (name == "customcursor" && mGui)
{
- bool bCustomCursor = config.getBoolValue("customcursor");
+ const bool bCustomCursor = config.getBoolValue("customcursor");
mGui->setUseCustomCursor(bCustomCursor);
}
}
@@ -74,7 +74,7 @@ class GuiConfigListener : public ConfigListener
Gui *mGui;
};
-Gui::Gui(Graphics *graphics):
+Gui::Gui(Graphics *const graphics):
mCustomCursor(false),
mMouseCursors(nullptr),
mMouseCursorAlpha(1.0f),
@@ -94,7 +94,7 @@ Gui::Gui(Graphics *graphics):
mFocusHandler = new FocusHandler;
// Initialize top GUI widget
- WindowContainer *guiTop = new WindowContainer;
+ WindowContainer *const guiTop = new WindowContainer;
guiTop->setFocusable(true);
guiTop->setSize(graphics->mWidth, graphics->mHeight);
guiTop->setOpaque(false);
@@ -256,7 +256,7 @@ Gui::~Gui()
void Gui::logic()
{
- ResourceManager *resman = ResourceManager::getInstance();
+ ResourceManager *const resman = ResourceManager::getInstance();
resman->clearScheduled();
if (!mTop)
@@ -383,12 +383,12 @@ void Gui::draw()
getTop()->draw(mGraphics);
int mouseX, mouseY;
- uint8_t button = SDL_GetMouseState(&mouseX, &mouseY);
+ const uint8_t button = SDL_GetMouseState(&mouseX, &mouseY);
if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1))
&& mMouseCursors && mCustomCursor && mMouseCursorAlpha > 0.0f)
{
- Image *mouseCursor = mMouseCursors->get(mCursorType);
+ Image *const mouseCursor = mMouseCursors->get(mCursorType);
if (mouseCursor)
{
mouseCursor->setAlpha(mMouseCursorAlpha);
@@ -403,21 +403,21 @@ void Gui::draw()
mGraphics->popClipArea();
}
-void Gui::videoResized()
+void Gui::videoResized() const
{
- WindowContainer *top = static_cast<WindowContainer*>(getTop());
+ WindowContainer *const top = static_cast<WindowContainer* const>(getTop());
if (top)
{
- int oldWidth = top->getWidth();
- int oldHeight = top->getHeight();
+ const int oldWidth = top->getWidth();
+ const int oldHeight = top->getHeight();
top->setSize(mainGraphics->mWidth, mainGraphics->mHeight);
top->adjustAfterResize(oldWidth, oldHeight);
}
}
-void Gui::setUseCustomCursor(bool customCursor)
+void Gui::setUseCustomCursor(const bool customCursor)
{
if (customCursor != mCustomCursor)
{
@@ -577,7 +577,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
break;
}
- gcn::Widget* swap = widget;
+ const gcn::Widget *const swap = widget;
widget = parent;
parent = swap->getParent();
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 6df01a5a9..d293e3015 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -50,7 +50,7 @@ class Gui : public gcn::Gui
/**
* Constructor.
*/
- Gui(Graphics *screen);
+ Gui(Graphics *const screen);
/**
* Destructor.
@@ -74,7 +74,7 @@ class Gui : public gcn::Gui
/**
* Called when the application window has been resized.
*/
- void videoResized();
+ void videoResized() const;
gcn::FocusHandler *getFocusHandler() const
{ return mFocusHandler; }
@@ -113,12 +113,12 @@ class Gui : public gcn::Gui
/**
* Sets whether a custom cursor should be rendered.
*/
- void setUseCustomCursor(bool customCursor);
+ void setUseCustomCursor(const bool customCursor);
/**
* Sets which cursor should be used.
*/
- void setCursorType(int index)
+ void setCursorType(const int index)
{ mCursorType = index; }
void updateFonts();
diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp
index 93413c4e8..1099aec3d 100644
--- a/src/gui/helpwindow.cpp
+++ b/src/gui/helpwindow.cpp
@@ -61,7 +61,7 @@ HelpWindow::HelpWindow():
mBrowserBox = new BrowserBox;
mBrowserBox->setOpaque(false);
mScrollArea = new ScrollArea(mBrowserBox, true, "help_background.xml");
- Button *okButton = new Button(_("Close"), "close", this);
+ Button *const okButton = new Button(_("Close"), "close", this);
mBrowserBox->setLinkHandler(this);
mBrowserBox->setFont(gui->getHelpFont());
@@ -166,7 +166,7 @@ void HelpWindow::search(const std::string &text0)
for (HelpNamesCIter it = names.begin(), it_end = names.end();
it != it_end; ++ it)
{
- const char *str = (*it).c_str();
+ const char *const str = (*it).c_str();
mBrowserBox->addRow(strprintf(" -> @@%s|%s@@", str,
translator->getChar(str)));
}
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index df99905b7..387e96da4 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -658,7 +658,7 @@ void BrowserBox::updateHeight()
}
}
-std::string BrowserBox::getTextAtPos(const int x, const int y)
+std::string BrowserBox::getTextAtPos(const int x, const int y) const
{
int textX = 0;
int textY = 0;
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index edea47ddf..c19256afa 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -200,7 +200,7 @@ class BrowserBox : public gcn::Widget,
void setEnableImages(bool n)
{ mEnableImages = n; }
- std::string getTextAtPos(const int x, const int y);
+ std::string getTextAtPos(const int x, const int y) const;
private:
int calcHeight();
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 09f2b35ee..27149a9f1 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -134,7 +134,7 @@ class ChatTab : public Tab
virtual void saveToLogFile(std::string &msg);
- std::list<std::string> &getRows()
+ std::list<std::string> &getRows() const
{ return mTextOutput->getRows(); }
bool hasRows() const