summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-20 21:19:35 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-20 21:19:35 +0300
commit3e8fecc9a62afff0054fa0fa23af86c8ef15a1c9 (patch)
tree2053748aba4fd1e01020effe9322757426354d28
parent2577a25f8a4acf587526809fda2ded95875e1222 (diff)
downloadmanaplus-3e8fecc9a62afff0054fa0fa23af86c8ef15a1c9.tar.gz
manaplus-3e8fecc9a62afff0054fa0fa23af86c8ef15a1c9.tar.bz2
manaplus-3e8fecc9a62afff0054fa0fa23af86c8ef15a1c9.tar.xz
manaplus-3e8fecc9a62afff0054fa0fa23af86c8ef15a1c9.zip
Add missing const in gui directory.
-rw-r--r--src/gui/focushandler.cpp8
-rw-r--r--src/gui/fonts/textchunklist_unittest.cc6
-rw-r--r--src/gui/models/namesmodel.cpp3
-rw-r--r--src/gui/models/namesmodel.h3
-rw-r--r--src/gui/models/playertablemodel.cpp4
-rw-r--r--src/gui/models/shopitems.cpp4
-rw-r--r--src/gui/models/shopitems.h2
-rw-r--r--src/gui/models/touchactionmodel.cpp2
-rw-r--r--src/gui/popups/beingpopup.cpp10
-rw-r--r--src/gui/popups/skillpopup.cpp2
-rw-r--r--src/gui/popups/skillpopup.h2
-rw-r--r--src/gui/shortcut/emoteshortcut.cpp4
-rw-r--r--src/gui/theme.h2
-rw-r--r--src/gui/viewport.cpp8
-rw-r--r--src/gui/viewport.h6
-rw-r--r--src/gui/widgets/avatarlistbox.cpp4
-rw-r--r--src/gui/widgets/basiccontainer.cpp25
-rw-r--r--src/gui/widgets/basiccontainer.h12
-rw-r--r--src/gui/widgets/basiccontainer2.cpp8
-rw-r--r--src/gui/widgets/basiccontainer2.h8
-rw-r--r--src/gui/widgets/browserbox.cpp4
-rw-r--r--src/gui/widgets/browserbox.h4
-rw-r--r--src/gui/widgets/browserbox_unittest.cc5
-rw-r--r--src/gui/widgets/button.cpp4
-rw-r--r--src/gui/widgets/button.h4
-rw-r--r--src/gui/widgets/colorpage.cpp4
-rw-r--r--src/gui/widgets/colorpage.h4
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/widgets/desktop.h4
-rw-r--r--src/gui/widgets/dropdown.cpp10
-rw-r--r--src/gui/widgets/dropdown.h10
-rw-r--r--src/gui/widgets/emotepage.cpp4
-rw-r--r--src/gui/widgets/emotepage.h4
-rw-r--r--src/gui/widgets/extendedlistbox.cpp4
-rw-r--r--src/gui/widgets/extendedlistbox.h4
-rw-r--r--src/gui/widgets/flowcontainer.cpp2
-rw-r--r--src/gui/widgets/flowcontainer.h2
-rw-r--r--src/gui/widgets/guitable.cpp12
-rw-r--r--src/gui/widgets/guitable.h12
-rw-r--r--src/gui/widgets/horizontcontainer.cpp2
-rw-r--r--src/gui/widgets/horizontcontainer.h2
-rw-r--r--src/gui/widgets/icon.cpp4
-rw-r--r--src/gui/widgets/icon.h4
-rw-r--r--src/gui/widgets/itemcontainer.cpp4
-rw-r--r--src/gui/widgets/itemcontainer.h4
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp3
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/itemshortcutcontainer.h4
-rw-r--r--src/gui/widgets/label.cpp6
-rw-r--r--src/gui/widgets/label.h6
-rw-r--r--src/gui/widgets/listbox.cpp4
-rw-r--r--src/gui/widgets/listbox.h4
-rw-r--r--src/gui/widgets/passwordfield.cpp4
-rw-r--r--src/gui/widgets/passwordfield.h4
-rw-r--r--src/gui/widgets/playerbox.cpp8
-rw-r--r--src/gui/widgets/playerbox.h9
-rw-r--r--src/gui/widgets/popup.cpp4
-rw-r--r--src/gui/widgets/popup.h4
-rw-r--r--src/gui/widgets/popuplist.cpp2
-rw-r--r--src/gui/widgets/popuplist.h2
-rw-r--r--src/gui/widgets/progressbar.cpp4
-rw-r--r--src/gui/widgets/progressbar.h4
-rw-r--r--src/gui/widgets/progressindicator.cpp14
-rw-r--r--src/gui/widgets/progressindicator.h6
-rw-r--r--src/gui/widgets/radiobutton.cpp6
-rw-r--r--src/gui/widgets/radiobutton.h6
-rw-r--r--src/gui/widgets/scrollarea.cpp8
-rw-r--r--src/gui/widgets/scrollarea.h9
-rw-r--r--src/gui/widgets/serverslistbox.h4
-rw-r--r--src/gui/widgets/setupquickitem.cpp4
-rw-r--r--src/gui/widgets/shoplistbox.cpp4
-rw-r--r--src/gui/widgets/shoplistbox.h4
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/shortcutcontainer.h4
-rw-r--r--src/gui/widgets/skilllistbox.h4
-rw-r--r--src/gui/widgets/slider.cpp4
-rw-r--r--src/gui/widgets/slider.h4
-rw-r--r--src/gui/widgets/sliderlist.cpp4
-rw-r--r--src/gui/widgets/sliderlist.h4
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/spellshortcutcontainer.h4
-rw-r--r--src/gui/widgets/tabbedarea.cpp13
-rw-r--r--src/gui/widgets/tabbedarea.h4
-rw-r--r--src/gui/widgets/tabs/tab.cpp4
-rw-r--r--src/gui/widgets/tabs/tab.h4
-rw-r--r--src/gui/widgets/textbox.cpp13
-rw-r--r--src/gui/widgets/textbox.h6
-rw-r--r--src/gui/widgets/textfield.cpp8
-rw-r--r--src/gui/widgets/textfield.h9
-rw-r--r--src/gui/widgets/textpreview.cpp4
-rw-r--r--src/gui/widgets/textpreview.h4
-rw-r--r--src/gui/widgets/virtshortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/virtshortcutcontainer.h4
-rw-r--r--src/gui/widgets/widget.cpp2
-rw-r--r--src/gui/widgets/widget.h6
-rw-r--r--src/gui/widgets/window.cpp4
-rw-r--r--src/gui/widgets/window.h4
-rw-r--r--src/gui/widgets/windowcontainer.cpp2
-rw-r--r--src/gui/widgets/windowcontainer.h2
-rw-r--r--src/gui/windowmanager.cpp4
-rw-r--r--src/gui/windowmanager.h4
-rw-r--r--src/gui/windowmenu.cpp10
-rw-r--r--src/gui/windowmenu.h6
-rw-r--r--src/gui/windows/buydialog.cpp3
-rw-r--r--src/gui/windows/buyingstoreselldialog.cpp6
-rw-r--r--src/gui/windows/charcreatedialog.cpp5
-rw-r--r--src/gui/windows/charselectdialog.cpp12
-rw-r--r--src/gui/windows/chatwindow.cpp4
-rw-r--r--src/gui/windows/chatwindow.h4
-rw-r--r--src/gui/windows/connectiondialog.cpp4
-rw-r--r--src/gui/windows/connectiondialog.h4
-rw-r--r--src/gui/windows/cutinwindow.cpp4
-rw-r--r--src/gui/windows/cutinwindow.h4
-rw-r--r--src/gui/windows/debugwindow.cpp4
-rw-r--r--src/gui/windows/debugwindow.h4
-rw-r--r--src/gui/windows/didyouknowwindow.cpp2
-rw-r--r--src/gui/windows/didyouknowwindow.h2
-rw-r--r--src/gui/windows/equipmentwindow.cpp4
-rw-r--r--src/gui/windows/equipmentwindow.h4
-rw-r--r--src/gui/windows/helpwindow.cpp2
-rw-r--r--src/gui/windows/helpwindow.h2
-rw-r--r--src/gui/windows/minimap.cpp4
-rw-r--r--src/gui/windows/minimap.h4
-rw-r--r--src/gui/windows/ministatuswindow.cpp4
-rw-r--r--src/gui/windows/ministatuswindow.h4
-rw-r--r--src/gui/windows/npcselldialog.cpp2
-rw-r--r--src/gui/windows/outfitwindow.cpp4
-rw-r--r--src/gui/windows/outfitwindow.h4
-rw-r--r--src/gui/windows/serverdialog.cpp12
-rw-r--r--src/gui/windows/serverdialog.h4
-rw-r--r--src/gui/windows/setupwindow.cpp4
-rw-r--r--src/gui/windows/setupwindow.h2
-rw-r--r--src/gui/windows/shopwindow.cpp8
-rw-r--r--src/gui/windows/socialwindow.cpp4
-rw-r--r--src/gui/windows/tradewindow.cpp4
-rw-r--r--src/gui/windows/updaterwindow.cpp42
-rw-r--r--src/gui/windows/updaterwindow.h6
137 files changed, 387 insertions, 341 deletions
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index 02588a353..5cfd4454a 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -337,7 +337,7 @@ void FocusHandler::distributeFocusGainedEvent(const Event &focusEvent)
if (gui)
gui->distributeGlobalFocusGainedEvent(focusEvent);
- Widget *const sourceWidget = focusEvent.getSource();
+ const Widget *const sourceWidget = focusEvent.getSource();
if (!sourceWidget)
return;
@@ -360,8 +360,8 @@ void FocusHandler::requestFocus(const Widget *const widget)
return;
int toBeFocusedIndex = -1;
- for (unsigned int i = 0, sz = CAST_U32(
- mWidgets.size()); i < sz; ++i)
+ for (unsigned int i = 0, fsz = CAST_U32(
+ mWidgets.size()); i < fsz; ++i)
{
if (mWidgets[i] == widget)
{
@@ -551,7 +551,7 @@ void FocusHandler::focusNone()
void FocusHandler::distributeFocusLostEvent(const Event& focusEvent)
{
- Widget *const sourceWidget = focusEvent.getSource();
+ const Widget *const sourceWidget = focusEvent.getSource();
if (!sourceWidget)
return;
diff --git a/src/gui/fonts/textchunklist_unittest.cc b/src/gui/fonts/textchunklist_unittest.cc
index 72d51b593..b0df7fc77 100644
--- a/src/gui/fonts/textchunklist_unittest.cc
+++ b/src/gui/fonts/textchunklist_unittest.cc
@@ -43,7 +43,7 @@ TEST_CASE("TextChunkList add 1", "TextChunkList")
{
TextChunkList list;
- TextChunk *chunk = new TextChunk("test",
+ TextChunk *const chunk = new TextChunk("test",
Color(1, 2, 3), Color(2, 3, 4), nullptr);
list.insertFirst(chunk);
@@ -66,9 +66,9 @@ TEST_CASE("TextChunkList add 2", "TextChunkList")
{
TextChunkList list;
- TextChunk *chunk1 = new TextChunk("test",
+ TextChunk *const chunk1 = new TextChunk("test",
Color(1, 2, 3), Color(3, 4, 5), nullptr);
- TextChunk *chunk2 = new TextChunk("test",
+ TextChunk *const chunk2 = new TextChunk("test",
Color(2, 3, 4), Color(4, 5, 6), nullptr);
list.insertFirst(chunk2);
diff --git a/src/gui/models/namesmodel.cpp b/src/gui/models/namesmodel.cpp
index 2e7606274..8d0d77251 100644
--- a/src/gui/models/namesmodel.cpp
+++ b/src/gui/models/namesmodel.cpp
@@ -45,7 +45,8 @@ std::string NamesModel::getElementAt(int i)
return mNames[CAST_SIZE(i)];
}
-void NamesModel::fillFromArray(const char *const *const arr, std::size_t sz)
+void NamesModel::fillFromArray(const char *const *const arr,
+ const std::size_t sz)
{
if (!arr)
return;
diff --git a/src/gui/models/namesmodel.h b/src/gui/models/namesmodel.h
index 0f75b0bc8..63af17db6 100644
--- a/src/gui/models/namesmodel.h
+++ b/src/gui/models/namesmodel.h
@@ -52,7 +52,8 @@ class NamesModel notfinal : public ListModel
void add(const std::string &str)
{ mNames.push_back(str); }
- void fillFromArray(const char *const *const arr, std::size_t size);
+ void fillFromArray(const char *const *const arr,
+ const std::size_t size);
protected:
StringVect mNames;
diff --git a/src/gui/models/playertablemodel.cpp b/src/gui/models/playertablemodel.cpp
index 80eab3694..e3458abc3 100644
--- a/src/gui/models/playertablemodel.cpp
+++ b/src/gui/models/playertablemodel.cpp
@@ -100,8 +100,8 @@ void PlayerTableModel::playerRelationsUpdated()
mPlayers = player_names;
// set up widgets
- for (unsigned int r = 0, sz = CAST_U32(
- player_names->size()); r < sz; ++r)
+ for (unsigned int r = 0, fsz = CAST_U32(
+ player_names->size()); r < fsz; ++r)
{
const std::string name = (*player_names)[r];
Widget *const widget = new Label(this, name);
diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp
index 952e5fe19..2a2b75ae8 100644
--- a/src/gui/models/shopitems.cpp
+++ b/src/gui/models/shopitems.cpp
@@ -103,9 +103,9 @@ ShopItem *ShopItems::addItem2(const int inventoryIndex,
return item;
}
-ShopItem *ShopItems::at(unsigned int i) const
+ShopItem *ShopItems::at(const size_t i) const
{
- if (i >= CAST_U32(mShopItems.size()))
+ if (i >= mShopItems.size())
return nullptr;
return mShopItems.at(i);
diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h
index c75fee7e1..d346c38b7 100644
--- a/src/gui/models/shopitems.h
+++ b/src/gui/models/shopitems.h
@@ -107,7 +107,7 @@ class ShopItems final : public ListModel
/**
* Returns the item number i in the shop.
*/
- ShopItem *at(unsigned int i) const A_WARN_UNUSED;
+ ShopItem *at(const size_t i) const A_WARN_UNUSED;
/**
* Removes an element from the shop.
diff --git a/src/gui/models/touchactionmodel.cpp b/src/gui/models/touchactionmodel.cpp
index c75c5985e..12059cb08 100644
--- a/src/gui/models/touchactionmodel.cpp
+++ b/src/gui/models/touchactionmodel.cpp
@@ -48,7 +48,7 @@ TouchActionsModel::TouchActionsModel() :
{
std::vector<SetupActionData*> data;
- for (int f = 0, sz = touchActionDataSize; f < sz; f ++)
+ for (int f = 0, fsz = touchActionDataSize; f < fsz; f ++)
{
int k = 0;
while (!touchActionData[f][k].name.empty())
diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp
index 7386ab055..d8d92f388 100644
--- a/src/gui/popups/beingpopup.cpp
+++ b/src/gui/popups/beingpopup.cpp
@@ -169,7 +169,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
const ActorTypeT type = b->getType();
if (type == ActorType::Pet)
{
- PetInfo *const info = PlayerInfo::getPet();
+ const PetInfo *const info = PlayerInfo::getPet();
if (info)
{
// TRANSLATORS: being popup label
@@ -190,7 +190,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else if (type == ActorType::Homunculus)
{
- HomunculusInfo *const info = PlayerInfo::getHomunculus();
+ const HomunculusInfo *const info = PlayerInfo::getHomunculus();
if (info)
{
// TRANSLATORS: being popup label
@@ -321,8 +321,10 @@ void BeingPopup::show(const int x, const int y, Being *const b)
std::string effectsStr;
FOR_EACH (std::set<int>::const_iterator, it, effects)
{
- StatusEffect *const effect = StatusEffect::getStatusEffect(
- *it, Enable_true);
+ const StatusEffect *const effect =
+ StatusEffect::getStatusEffect(
+ *it,
+ Enable_true);
if (!effect)
continue;
if (!effectsStr.empty())
diff --git a/src/gui/popups/skillpopup.cpp b/src/gui/popups/skillpopup.cpp
index 68fb42454..879e48a80 100644
--- a/src/gui/popups/skillpopup.cpp
+++ b/src/gui/popups/skillpopup.cpp
@@ -85,7 +85,7 @@ SkillPopup::~SkillPopup()
}
void SkillPopup::show(const SkillInfo *const skill,
- int level)
+ const int level)
{
if (!skill ||
!skill->data ||
diff --git a/src/gui/popups/skillpopup.h b/src/gui/popups/skillpopup.h
index b5c47f808..ab170002f 100644
--- a/src/gui/popups/skillpopup.h
+++ b/src/gui/popups/skillpopup.h
@@ -55,7 +55,7 @@ class SkillPopup final : public Popup
* Sets the info to be displayed given a particular item.
*/
void show(const SkillInfo *const skill,
- int level);
+ const int level);
void mouseMoved(MouseEvent &event) override final;
diff --git a/src/gui/shortcut/emoteshortcut.cpp b/src/gui/shortcut/emoteshortcut.cpp
index c49dc2ab8..b5a2428af 100644
--- a/src/gui/shortcut/emoteshortcut.cpp
+++ b/src/gui/shortcut/emoteshortcut.cpp
@@ -46,8 +46,8 @@ EmoteShortcut::~EmoteShortcut()
void EmoteShortcut::load()
{
for (unsigned char i = 0, j = 0,
- sz = CAST_U8(EmoteDB::getLast());
- i <= sz && j < SHORTCUT_EMOTES;
+ fsz = CAST_U8(EmoteDB::getLast());
+ i <= fsz && j < SHORTCUT_EMOTES;
i++)
{
const EmoteSprite *const sprite = EmoteDB::getSprite(i, true);
diff --git a/src/gui/theme.h b/src/gui/theme.h
index 91d1064be..545700c20 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -143,7 +143,7 @@ class Theme final : public Palette,
CAST_U32(mColors.size()));
type = ThemeColorId::BROWSERBOX;
}
- Color* col = &mColors[CAST_SIZE(type)].color;
+ Color *const col = &mColors[CAST_SIZE(type)].color;
col->a = alpha;
return *col;
}
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index e7162f399..1a8231780 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -115,7 +115,7 @@ void Viewport::setMap(Map *const map)
mMap = map;
}
-void Viewport::draw(Graphics *graphics)
+void Viewport::draw(Graphics *const graphics)
{
BLOCK_START("Viewport::draw 1")
static int lastTick = tick_time;
@@ -268,7 +268,7 @@ void Viewport::draw(Graphics *graphics)
BLOCK_END("Viewport::draw 1")
}
-void Viewport::safeDraw(Graphics *graphics)
+void Viewport::safeDraw(Graphics *const graphics)
{
Viewport::draw(graphics);
}
@@ -584,8 +584,8 @@ void Viewport::getMouseTile(int &destX, int &destY)
getMouseTile(mMouseX, mMouseY, destX, destY);
}
-void Viewport::getMouseTile(const int x, int y,
- int &destX, int &destY)
+void Viewport::getMouseTile(const int x, const int y,
+ int &destX, int &destY) const
{
const int tw = mMap->getTileWidth();
const int th = mMap->getTileHeight();
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index ac1360cb5..1a959a858 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -76,9 +76,9 @@ class Viewport final : public WindowContainer,
/**
* Draws the viewport.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Implements player to keep following mouse.
@@ -206,7 +206,7 @@ class Viewport final : public WindowContainer,
void getMouseTile(const int x,
const int y,
int &destX,
- int &destY);
+ int &destY) const;
/**
* Make the player go to the mouse position.
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 25ef34135..7caf28d7d 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -98,7 +98,7 @@ AvatarListBox::~AvatarListBox()
}
}
-void AvatarListBox::draw(Graphics *graphics)
+void AvatarListBox::draw(Graphics *const graphics)
{
BLOCK_START("AvatarListBox::draw")
if (!mListModel || !localPlayer)
@@ -343,7 +343,7 @@ void AvatarListBox::draw(Graphics *graphics)
BLOCK_END("AvatarListBox::draw")
}
-void AvatarListBox::safeDraw(Graphics *graphics)
+void AvatarListBox::safeDraw(Graphics *const graphics)
{
BLOCK_START("AvatarListBox::draw")
if (!mListModel || !localPlayer)
diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp
index 15042b971..26434d7e9 100644
--- a/src/gui/widgets/basiccontainer.cpp
+++ b/src/gui/widgets/basiccontainer.cpp
@@ -72,7 +72,7 @@ BasicContainer::~BasicContainer()
clear();
}
-void BasicContainer::moveToTop(Widget *widget) restrict2
+void BasicContainer::moveToTop(Widget *const widget) restrict2
{
FOR_EACH (WidgetListIterator, iter, mWidgets)
{
@@ -94,9 +94,9 @@ void BasicContainer::moveToTop(Widget *widget) restrict2
}
}
-void BasicContainer::moveToBottom(Widget *widget) restrict2
+void BasicContainer::moveToBottom(Widget *const widget) restrict2
{
- WidgetListIterator iter = std::find(mWidgets.begin(),
+ const WidgetListIterator iter = std::find(mWidgets.begin(),
mWidgets.end(), widget);
if (iter != mWidgets.end())
{
@@ -104,7 +104,7 @@ void BasicContainer::moveToBottom(Widget *widget) restrict2
mWidgets.insert(mWidgets.begin(), widget);
}
- WidgetListIterator iter2 = std::find(mLogicWidgets.begin(),
+ const WidgetListIterator iter2 = std::find(mLogicWidgets.begin(),
mLogicWidgets.end(), widget);
if (iter2 != mLogicWidgets.end())
{
@@ -115,12 +115,12 @@ void BasicContainer::moveToBottom(Widget *widget) restrict2
void BasicContainer::death(const Event &restrict event) restrict2
{
- WidgetListIterator iter = std::find(mWidgets.begin(),
+ const WidgetListIterator iter = std::find(mWidgets.begin(),
mWidgets.end(), event.getSource());
if (iter != mWidgets.end())
mWidgets.erase(iter);
- WidgetListIterator iter2 = std::find(mLogicWidgets.begin(),
+ const WidgetListIterator iter2 = std::find(mLogicWidgets.begin(),
mLogicWidgets.end(), event.getSource());
if (iter2 != mLogicWidgets.end())
mLogicWidgets.erase(iter2);
@@ -141,7 +141,7 @@ void BasicContainer::focusNext() restrict2
break;
}
- WidgetListConstIterator end = it;
+ const WidgetListConstIterator end = it;
if (it == mWidgets.end())
it = mWidgets.begin();
@@ -256,7 +256,7 @@ void BasicContainer::add(Widget *const widget) restrict2
widget->addDeathListener(this);
}
-void BasicContainer::remove(Widget *restrict widget) restrict2
+void BasicContainer::remove(Widget *const restrict widget) restrict2
{
if (!widget)
return;
@@ -297,7 +297,7 @@ void BasicContainer::clear() restrict2
mLogicWidgets.clear();
}
-void BasicContainer::drawChildren(Graphics *restrict graphics) restrict2
+void BasicContainer::drawChildren(Graphics *const restrict graphics) restrict2
{
BLOCK_START("BasicContainer::drawChildren")
graphics->pushClipArea(getChildrenArea());
@@ -337,7 +337,8 @@ void BasicContainer::drawChildren(Graphics *restrict graphics) restrict2
BLOCK_END("BasicContainer::drawChildren")
}
-void BasicContainer::safeDrawChildren(Graphics *restrict graphics) restrict2
+void BasicContainer::safeDrawChildren(Graphics *const restrict graphics)
+ restrict2
{
BLOCK_START("BasicContainer::drawChildren")
graphics->pushClipArea(getChildrenArea());
@@ -409,12 +410,12 @@ void BasicContainer::showWidgetPart(Widget *restrict const widget,
widget->setY(widgetArea.height - area.y - area.height);
}
-void BasicContainer::setInternalFocusHandler(FocusHandler *restrict
+void BasicContainer::setInternalFocusHandler(FocusHandler *const restrict
focusHandler) restrict2
{
Widget::setInternalFocusHandler(focusHandler);
- FocusHandler *restrict handler = mInternalFocusHandler ?
+ FocusHandler *const restrict handler = mInternalFocusHandler ?
mInternalFocusHandler : getFocusHandler();
FOR_EACH (WidgetListConstIterator, iter, mWidgets)
{
diff --git a/src/gui/widgets/basiccontainer.h b/src/gui/widgets/basiccontainer.h
index 8fe2bc54b..a6420db67 100644
--- a/src/gui/widgets/basiccontainer.h
+++ b/src/gui/widgets/basiccontainer.h
@@ -110,9 +110,9 @@ class BasicContainer notfinal : public Widget,
// Inherited from Widget
- void moveToTop(Widget *widget) restrict2 override;
+ void moveToTop(Widget *const widget) restrict2 override;
- void moveToBottom(Widget *widget) restrict2 override;
+ void moveToBottom(Widget *const widget) restrict2 override;
Rect getChildrenArea() restrict2 override A_WARN_UNUSED;
@@ -125,7 +125,7 @@ class BasicContainer notfinal : public Widget,
void setFocusHandler(FocusHandler *restrict const focusHandler)
restrict2 override;
- void setInternalFocusHandler(FocusHandler *restrict focusHandler)
+ void setInternalFocusHandler(FocusHandler *const restrict focusHandler)
restrict2;
Widget *getWidgetAt(int x, int y) restrict2 override A_WARN_UNUSED;
@@ -151,7 +151,7 @@ class BasicContainer notfinal : public Widget,
* @param widget The widget to remove.
* @see add, clear
*/
- virtual void remove(Widget *restrict widget) restrict2;
+ virtual void remove(Widget *const restrict widget) restrict2;
/**
* Clears the basic container from all widgets.
@@ -166,10 +166,10 @@ class BasicContainer notfinal : public Widget,
*
* @param graphics A graphics object to draw with.
*/
- virtual void drawChildren(Graphics *restrict graphics)
+ virtual void drawChildren(Graphics *const restrict graphics)
restrict2 A_NONNULL(2);
- virtual void safeDrawChildren(Graphics *restrict graphics)
+ virtual void safeDrawChildren(Graphics *const restrict graphics)
restrict2 A_NONNULL(2);
/**
diff --git a/src/gui/widgets/basiccontainer2.cpp b/src/gui/widgets/basiccontainer2.cpp
index 3d67c5ace..862fa641c 100644
--- a/src/gui/widgets/basiccontainer2.cpp
+++ b/src/gui/widgets/basiccontainer2.cpp
@@ -79,7 +79,7 @@ BasicContainer2::~BasicContainer2()
{
}
-void BasicContainer2::draw(Graphics* graphics)
+void BasicContainer2::draw(Graphics *const graphics)
{
BLOCK_START("BasicContainer2::draw")
if (mOpaque)
@@ -93,7 +93,7 @@ void BasicContainer2::draw(Graphics* graphics)
BLOCK_END("BasicContainer2::draw")
}
-void BasicContainer2::safeDraw(Graphics* graphics)
+void BasicContainer2::safeDraw(Graphics *const graphics)
{
BLOCK_START("BasicContainer2::draw")
if (isOpaque())
@@ -107,7 +107,7 @@ void BasicContainer2::safeDraw(Graphics* graphics)
BLOCK_END("BasicContainer2::draw")
}
-void BasicContainer2::add(Widget* widget)
+void BasicContainer2::add(Widget *const widget)
{
// +++ need move all add() calls from constructors
// and after this method can be deleted
@@ -115,7 +115,7 @@ void BasicContainer2::add(Widget* widget)
BasicContainer::add(widget);
}
-void BasicContainer2::addXY(Widget* widget,
+void BasicContainer2::addXY(Widget *const widget,
const int x,
const int y)
{
diff --git a/src/gui/widgets/basiccontainer2.h b/src/gui/widgets/basiccontainer2.h
index 8de344264..e7cba01d6 100644
--- a/src/gui/widgets/basiccontainer2.h
+++ b/src/gui/widgets/basiccontainer2.h
@@ -120,7 +120,7 @@ class BasicContainer2: public BasicContainer
* @param widget The widget to add.
* @see remove, clear
*/
- virtual void add(Widget* widget);
+ virtual void add(Widget *const widget);
/**
* Adds a widget to the container and also specifies the widget's
@@ -132,14 +132,14 @@ class BasicContainer2: public BasicContainer
* @param y The y coordinate for the widget.
* @see remove, clear
*/
- void addXY(Widget* widget,
+ void addXY(Widget *const widget,
const int x, const int y);
// Inherited from Widget
- void draw(Graphics* graphics) override A_NONNULL(2);
+ void draw(Graphics *const graphics) override A_NONNULL(2);
- void safeDraw(Graphics* graphics) override A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override A_NONNULL(2);
protected:
/**
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 52ba88a7b..2c936ac96 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -486,7 +486,7 @@ void BrowserBox::mouseExited(MouseEvent &event A_UNUSED)
mSelectedLink = -1;
}
-void BrowserBox::draw(Graphics *graphics)
+void BrowserBox::draw(Graphics *const graphics)
{
BLOCK_START("BrowserBox::draw")
const ClipRect &cr = graphics->getTopClip();
@@ -568,7 +568,7 @@ void BrowserBox::draw(Graphics *graphics)
BLOCK_END("BrowserBox::draw")
}
-void BrowserBox::safeDraw(Graphics *graphics)
+void BrowserBox::safeDraw(Graphics *const graphics)
{
BrowserBox::draw(graphics);
}
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index 7bff334c2..d0655631c 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -122,9 +122,9 @@ class BrowserBox final : public Widget,
/**
* Draws the browser box.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void updateHeight();
diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc
index 9fe75dda5..1bae1f294 100644
--- a/src/gui/widgets/browserbox_unittest.cc
+++ b/src/gui/widgets/browserbox_unittest.cc
@@ -43,7 +43,10 @@ TEST_CASE("BrowserBox tests", "browserbox")
theme = new Theme;
Widget::setGlobalFont(new Font("/usr/share/fonts/truetype/"
"ttf-dejavu/DejaVuSans-Oblique.ttf", 18));
- BrowserBox *box = new BrowserBox(nullptr, BrowserBox::AUTO_WRAP, true, "");
+ BrowserBox *const box = new BrowserBox(nullptr,
+ BrowserBox::AUTO_WRAP,
+ true,
+ "");
box->setWidth(100);
std::string row = "test";
box->addRow(row);
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 97291276b..246e08a8e 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -460,7 +460,7 @@ void Button::updateAlpha()
}
}
-void Button::draw(Graphics *graphics)
+void Button::draw(Graphics *const graphics)
{
BLOCK_START("Button::draw")
int mode;
@@ -639,7 +639,7 @@ void Button::draw(Graphics *graphics)
BLOCK_END("Button::draw")
}
-void Button::safeDraw(Graphics *graphics)
+void Button::safeDraw(Graphics *const graphics)
{
BLOCK_START("Button::safeDraw")
int mode;
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index 952b412a2..f994f413b 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -151,9 +151,9 @@ class Button final : public Widget,
/**
* Draws the button.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Update the alpha value to the button components.
diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp
index 53e312769..82ed92b69 100644
--- a/src/gui/widgets/colorpage.cpp
+++ b/src/gui/widgets/colorpage.cpp
@@ -49,7 +49,7 @@ ColorPage::~ColorPage()
{
}
-void ColorPage::draw(Graphics *graphics)
+void ColorPage::draw(Graphics *const graphics)
{
BLOCK_START("ColorPage::draw")
@@ -99,7 +99,7 @@ void ColorPage::draw(Graphics *graphics)
BLOCK_END("ColorPage::draw")
}
-void ColorPage::safeDraw(Graphics *graphics)
+void ColorPage::safeDraw(Graphics *const graphics)
{
ColorPage::draw(graphics);
}
diff --git a/src/gui/widgets/colorpage.h b/src/gui/widgets/colorpage.h
index 67b45a3ce..f191966cc 100644
--- a/src/gui/widgets/colorpage.h
+++ b/src/gui/widgets/colorpage.h
@@ -36,9 +36,9 @@ class ColorPage final : public ListBox
~ColorPage();
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void resetAction();
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 4eee2de9d..aab966f9c 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -114,7 +114,7 @@ void Desktop::widgetResized(const Event &event A_UNUSED)
setBestFittingWallpaper();
}
-void Desktop::draw(Graphics *graphics)
+void Desktop::draw(Graphics *const graphics)
{
BLOCK_START("Desktop::draw")
GLDEBUG_START("Desktop::draw")
@@ -155,7 +155,7 @@ void Desktop::draw(Graphics *graphics)
BLOCK_END("Desktop::draw")
}
-void Desktop::safeDraw(Graphics *graphics)
+void Desktop::safeDraw(Graphics *const graphics)
{
Desktop::draw(graphics);
}
diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h
index 4bc41771d..263bbabce 100644
--- a/src/gui/widgets/desktop.h
+++ b/src/gui/widgets/desktop.h
@@ -65,9 +65,9 @@ class Desktop final : public Container,
void widgetResized(const Event &event) override final;
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void postInit() override final;
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 506503e01..8f1a811e2 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -207,7 +207,7 @@ void DropDown::updateAlpha()
}
}
-void DropDown::draw(Graphics* graphics)
+void DropDown::draw(Graphics *const graphics)
{
BLOCK_START("DropDown::draw")
int h;
@@ -286,12 +286,12 @@ void DropDown::draw(Graphics* graphics)
BLOCK_END("DropDown::draw")
}
-void DropDown::safeDraw(Graphics* graphics)
+void DropDown::safeDraw(Graphics *const graphics)
{
DropDown::draw(graphics);
}
-void DropDown::drawFrame(Graphics *graphics)
+void DropDown::drawFrame(Graphics *const graphics)
{
BLOCK_START("DropDown::drawFrame")
const int bs2 = CAST_S32(getFrameSize());
@@ -302,7 +302,7 @@ void DropDown::drawFrame(Graphics *graphics)
BLOCK_END("DropDown::drawFrame")
}
-void DropDown::safeDrawFrame(Graphics *graphics)
+void DropDown::safeDrawFrame(Graphics *const graphics)
{
BLOCK_START("DropDown::drawFrame")
const int bs2 = CAST_S32(getFrameSize());
@@ -313,7 +313,7 @@ void DropDown::safeDrawFrame(Graphics *graphics)
BLOCK_END("DropDown::drawFrame")
}
-void DropDown::drawButton(Graphics *graphics)
+void DropDown::drawButton(Graphics *const graphics)
{
const int height = mDroppedDown ? mFoldedUpHeight : mDimension.height;
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index e485aa65b..c3f7c002c 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -79,13 +79,13 @@ class DropDown final : public ActionListener,
*/
void updateAlpha();
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
- void drawFrame(Graphics *graphics) override final A_NONNULL(2);
+ void drawFrame(Graphics *const graphics) override final A_NONNULL(2);
- void safeDrawFrame(Graphics *graphics) override final A_NONNULL(2);
+ void safeDrawFrame(Graphics *const graphics) override final A_NONNULL(2);
// Inherited from KeyListener
@@ -143,7 +143,7 @@ class DropDown final : public ActionListener,
*
* @param graphics a Graphics object to draw with.
*/
- void drawButton(Graphics *graphics) A_NONNULL(2);
+ void drawButton(Graphics *const graphics) A_NONNULL(2);
PopupList *mPopup A_NONNULLPOINTER;
Color mShadowColor;
diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp
index 6e3732413..d6903d49d 100644
--- a/src/gui/widgets/emotepage.cpp
+++ b/src/gui/widgets/emotepage.cpp
@@ -59,7 +59,7 @@ EmotePage::~EmotePage()
delete2(mVertexes);
}
-void EmotePage::draw(Graphics *graphics)
+void EmotePage::draw(Graphics *const graphics)
{
BLOCK_START("EmotePage::draw")
@@ -97,7 +97,7 @@ void EmotePage::draw(Graphics *graphics)
BLOCK_END("EmotePage::draw")
}
-void EmotePage::safeDraw(Graphics *graphics)
+void EmotePage::safeDraw(Graphics *const graphics)
{
BLOCK_START("EmotePage::safeDraw")
diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h
index 75a9ec730..a12bc5f1a 100644
--- a/src/gui/widgets/emotepage.h
+++ b/src/gui/widgets/emotepage.h
@@ -39,9 +39,9 @@ class EmotePage final : public Widget,
~EmotePage();
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void mousePressed(MouseEvent &event) override final;
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index fd9b4c660..927b2132b 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -47,7 +47,7 @@ ExtendedListBox::~ExtendedListBox()
{
}
-void ExtendedListBox::draw(Graphics *graphics)
+void ExtendedListBox::draw(Graphics *const graphics)
{
if (!mListModel)
return;
@@ -215,7 +215,7 @@ void ExtendedListBox::draw(Graphics *graphics)
BLOCK_END("ExtendedListBox::draw")
}
-void ExtendedListBox::safeDraw(Graphics *graphics)
+void ExtendedListBox::safeDraw(Graphics *const graphics)
{
ExtendedListBox::draw(graphics);
}
diff --git a/src/gui/widgets/extendedlistbox.h b/src/gui/widgets/extendedlistbox.h
index 56950ca27..6e40ecc2b 100644
--- a/src/gui/widgets/extendedlistbox.h
+++ b/src/gui/widgets/extendedlistbox.h
@@ -42,9 +42,9 @@ class ExtendedListBox final : public ListBox
/**
* Draws the list box.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void adjustSize() override;
diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp
index d6f10248e..851cf9db3 100644
--- a/src/gui/widgets/flowcontainer.cpp
+++ b/src/gui/widgets/flowcontainer.cpp
@@ -86,7 +86,7 @@ void FlowContainer::widgetResized(const Event &event A_UNUSED)
}
}
-void FlowContainer::add(Widget *widget)
+void FlowContainer::add(Widget *const widget)
{
if (!widget)
return;
diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h
index bbb5ba041..5e47af759 100644
--- a/src/gui/widgets/flowcontainer.h
+++ b/src/gui/widgets/flowcontainer.h
@@ -64,7 +64,7 @@ class FlowContainer final : public Container,
int getBoxHeight() const A_WARN_UNUSED
{ return mBoxHeight; }
- void add(Widget *widget) override final;
+ void add(Widget *const widget) override final;
private:
int mBoxWidth;
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index c41d4886c..c6acc33da 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -220,7 +220,7 @@ void GuiTable::installActionListeners()
}
// -- widget ops
-void GuiTable::draw(Graphics* graphics)
+void GuiTable::draw(Graphics *const graphics)
{
if (!getRowHeight())
return;
@@ -338,7 +338,7 @@ void GuiTable::draw(Graphics* graphics)
BLOCK_END("GuiTable::draw")
}
-void GuiTable::safeDraw(Graphics* graphics)
+void GuiTable::safeDraw(Graphics *const graphics)
{
if (!getRowHeight())
return;
@@ -456,13 +456,13 @@ void GuiTable::safeDraw(Graphics* graphics)
BLOCK_END("GuiTable::draw")
}
-void GuiTable::moveToTop(Widget *widget)
+void GuiTable::moveToTop(Widget *const widget)
{
Widget::moveToTop(widget);
mTopWidget = widget;
}
-void GuiTable::moveToBottom(Widget *widget)
+void GuiTable::moveToBottom(Widget *const widget)
{
Widget::moveToBottom(widget);
if (widget == mTopWidget)
@@ -608,7 +608,7 @@ Widget *GuiTable::getWidgetAt(int x, int y)
return nullptr;
}
-int GuiTable::getRowForY(int y) const
+int GuiTable::getRowForY(const int y) const
{
int row = -1;
@@ -622,7 +622,7 @@ int GuiTable::getRowForY(int y) const
return row;
}
-int GuiTable::getColumnForX(int x) const
+int GuiTable::getColumnForX(const int x) const
{
int column;
int delta = 0;
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index 4b9e7e8a0..35000ccff 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -110,15 +110,15 @@ class GuiTable final : public Widget,
{ mLinewiseMode = linewise; }
// Inherited from Widget
- void draw(Graphics* graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics* graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED;
- void moveToTop(Widget *child) override final;
+ void moveToTop(Widget *const widget) override final;
- void moveToBottom(Widget *child) override final;
+ void moveToBottom(Widget *const widget) override final;
void setFocusHandler(FocusHandler *const focusHandler) override final;
@@ -172,9 +172,9 @@ class GuiTable final : public Widget,
int getColumnWidth(const int i) const A_WARN_UNUSED;
private:
- int getRowForY(int y) const A_WARN_UNUSED; // -1 on error
+ int getRowForY(const int y) const A_WARN_UNUSED; // -1 on error
- int getColumnForX(int x) const A_WARN_UNUSED; // -1 on error
+ int getColumnForX(const int x) const A_WARN_UNUSED; // -1 on error
void recomputeDimensions();
diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp
index c4cd68249..9db91d4ab 100644
--- a/src/gui/widgets/horizontcontainer.cpp
+++ b/src/gui/widgets/horizontcontainer.cpp
@@ -38,7 +38,7 @@ HorizontContainer::HorizontContainer(const Widget2 *const widget,
addMouseListener(this);
}
-void HorizontContainer::add(Widget *widget)
+void HorizontContainer::add(Widget *const widget)
{
add(widget, mSpacing);
}
diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h
index 7dde487f3..23ca5159c 100644
--- a/src/gui/widgets/horizontcontainer.h
+++ b/src/gui/widgets/horizontcontainer.h
@@ -45,7 +45,7 @@ class HorizontContainer final : public Container,
A_DELETE_COPY(HorizontContainer)
- void add(Widget *widget) override final;
+ void add(Widget *const widget) override final;
void add(Widget *const widget, const int spacing);
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index e5c61d941..855ea7a20 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -77,7 +77,7 @@ void Icon::setImage(Image *const image)
}
}
-void Icon::draw(Graphics *graphics)
+void Icon::draw(Graphics *const graphics)
{
BLOCK_START("Icon::draw")
if (mImage)
@@ -89,7 +89,7 @@ void Icon::draw(Graphics *graphics)
BLOCK_END("Icon::draw")
}
-void Icon::safeDraw(Graphics *graphics)
+void Icon::safeDraw(Graphics *const graphics)
{
BLOCK_START("Icon::draw")
if (mImage)
diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h
index c82fb1ccc..e630339d8 100644
--- a/src/gui/widgets/icon.h
+++ b/src/gui/widgets/icon.h
@@ -71,9 +71,9 @@ class Icon final : public Widget
/**
* Draws the Icon.
*/
- void draw(Graphics *g) override final A_NONNULL(2);
+ void draw(Graphics *const g) override final A_NONNULL(2);
- void safeDraw(Graphics *g) override final A_NONNULL(2);
+ void safeDraw(Graphics *const g) override final A_NONNULL(2);
private:
Image *mImage;
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 2a9ea0ed7..02ad10ee9 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -261,7 +261,7 @@ void ItemContainer::logic()
BLOCK_END("ItemContainer::logic")
}
-void ItemContainer::draw(Graphics *graphics)
+void ItemContainer::draw(Graphics *const graphics)
{
if (!mInventory || !mShowMatrix)
return;
@@ -392,7 +392,7 @@ void ItemContainer::draw(Graphics *graphics)
BLOCK_END("ItemContainer::draw")
}
-void ItemContainer::safeDraw(Graphics *graphics)
+void ItemContainer::safeDraw(Graphics *const graphics)
{
if (!mInventory || !mShowMatrix)
return;
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index 76f2c7f9b..b4fa698d7 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -79,9 +79,9 @@ class ItemContainer final : public Widget,
/**
* Draws the items.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
// KeyListener
void keyPressed(KeyEvent &event) override final A_CONST;
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index b7ffe5e70..80559b130 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -157,7 +157,8 @@ void ItemLinkHandler::handleSearchLink(const std::string &link)
}
}
-void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
+void ItemLinkHandler::handleLink(const std::string &link,
+ MouseEvent *const event)
{
logger->log("link: " + link);
if (strStartWith(link, "http://") || strStartWith(link, "https://"))
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 75f045944..9604d33d8 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -84,7 +84,7 @@ void ItemShortcutContainer::setWidget2(const Widget2 *const widget)
mForegroundColor2 = getThemeColor(ThemeColorId::TEXT_OUTLINE);
}
-void ItemShortcutContainer::draw(Graphics *graphics)
+void ItemShortcutContainer::draw(Graphics *const graphics)
{
BLOCK_START("ItemShortcutContainer::draw")
const ItemShortcut *const selShortcut = itemShortcut[mNumber];
@@ -221,7 +221,7 @@ void ItemShortcutContainer::draw(Graphics *graphics)
BLOCK_END("ItemShortcutContainer::draw")
}
-void ItemShortcutContainer::safeDraw(Graphics *graphics)
+void ItemShortcutContainer::safeDraw(Graphics *const graphics)
{
BLOCK_START("ItemShortcutContainer::draw")
const ItemShortcut *const selShortcut = itemShortcut[mNumber];
diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h
index f492f7dbd..9e043663b 100644
--- a/src/gui/widgets/itemshortcutcontainer.h
+++ b/src/gui/widgets/itemshortcutcontainer.h
@@ -49,9 +49,9 @@ class ItemShortcutContainer final : public ShortcutContainer
/**
* Draws the items.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Handles mouse when dragged.
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index cdecb9115..2f3ec268e 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -141,7 +141,7 @@ void Label::init()
mPadding = 0;
}
-void Label::draw(Graphics* graphics)
+void Label::draw(Graphics *const graphics)
{
BLOCK_START("Label::draw")
int textX;
@@ -183,7 +183,7 @@ void Label::draw(Graphics* graphics)
BLOCK_END("Label::draw")
}
-void Label::safeDraw(Graphics* graphics)
+void Label::safeDraw(Graphics *const graphics)
{
Label::draw(graphics);
}
@@ -259,7 +259,7 @@ void Label::setCaption(const std::string& caption)
mCaption = caption;
}
-void Label::setParent(Widget *widget)
+void Label::setParent(Widget *const widget)
{
if (mWindow)
mWindow->addWidgetListener(this);
diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h
index cb1ab4072..3d9e5f941 100644
--- a/src/gui/widgets/label.h
+++ b/src/gui/widgets/label.h
@@ -108,9 +108,9 @@ class Label final : public Widget,
/**
* Draws the label.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void adjustSize();
@@ -160,7 +160,7 @@ class Label final : public Widget,
Graphics::Alignment getAlignment() const
{ return mAlignment; }
- void setParent(Widget *widget) override final;
+ void setParent(Widget *const widget) override final;
void setWindow(Widget *const widget) override final;
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index ced9dcb99..180a0e877 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -149,7 +149,7 @@ void ListBox::updateAlpha()
mAlpha = alpha;
}
-void ListBox::draw(Graphics *graphics)
+void ListBox::draw(Graphics *const graphics)
{
if (!mListModel)
return;
@@ -269,7 +269,7 @@ void ListBox::keyPressed(KeyEvent &event)
}
}
-void ListBox::safeDraw(Graphics *graphics)
+void ListBox::safeDraw(Graphics *const graphics)
{
ListBox::draw(graphics);
}
diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h
index 8a6f34373..97ee63ba7 100644
--- a/src/gui/widgets/listbox.h
+++ b/src/gui/widgets/listbox.h
@@ -108,9 +108,9 @@ class ListBox notfinal : public Widget,
/**
* Draws the list box.
*/
- void draw(Graphics *graphics) override A_NONNULL(2);
+ void draw(Graphics *const graphics) override A_NONNULL(2);
- void safeDraw(Graphics *graphics) override A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override A_NONNULL(2);
/**
* Update the alpha value to the graphic components.
diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp
index ae47d4500..0017fddc9 100644
--- a/src/gui/widgets/passwordfield.cpp
+++ b/src/gui/widgets/passwordfield.cpp
@@ -35,7 +35,7 @@ PasswordField::PasswordField(const Widget2 *const widget,
{
}
-void PasswordField::draw(Graphics *graphics)
+void PasswordField::draw(Graphics *const graphics)
{
BLOCK_START("PasswordField::draw")
// std::string uses cow, thus cheap copy
@@ -49,7 +49,7 @@ void PasswordField::draw(Graphics *graphics)
BLOCK_END("PasswordField::draw")
}
-void PasswordField::safeDraw(Graphics *graphics)
+void PasswordField::safeDraw(Graphics *const graphics)
{
PasswordField::draw(graphics);
}
diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h
index 78b4f94ac..305adf739 100644
--- a/src/gui/widgets/passwordfield.h
+++ b/src/gui/widgets/passwordfield.h
@@ -44,9 +44,9 @@ class PasswordField final : public TextField
/**
* Draws the password field.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
protected:
char mPasswordChar;
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index ac893b850..d796458da 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -115,7 +115,7 @@ void PlayerBox::init(std::string name, std::string selectedName)
}
}
-void PlayerBox::draw(Graphics *graphics)
+void PlayerBox::draw(Graphics *const graphics)
{
BLOCK_START("PlayerBox::draw")
if (mBeing)
@@ -138,12 +138,12 @@ void PlayerBox::draw(Graphics *graphics)
BLOCK_END("PlayerBox::draw")
}
-void PlayerBox::safeDraw(Graphics *graphics)
+void PlayerBox::safeDraw(Graphics *const graphics)
{
PlayerBox::draw(graphics);
}
-void PlayerBox::drawFrame(Graphics *graphics)
+void PlayerBox::drawFrame(Graphics *const graphics)
{
BLOCK_START("PlayerBox::drawFrame")
if (mDrawBackground)
@@ -160,7 +160,7 @@ void PlayerBox::drawFrame(Graphics *graphics)
BLOCK_END("PlayerBox::drawFrame")
}
-void PlayerBox::safeDrawFrame(Graphics *graphics)
+void PlayerBox::safeDrawFrame(Graphics *const graphics)
{
BLOCK_START("PlayerBox::drawFrame")
if (mDrawBackground)
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index c13704b44..1a122fbbd 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -76,16 +76,17 @@ class PlayerBox final : public Widget,
/**
* Draws the scroll area.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Draws the background and border of the scroll area.
*/
- void drawFrame(Graphics *graphics) override final A_NONNULL(2);
+ void drawFrame(Graphics *const graphics) override final A_NONNULL(2);
- void safeDrawFrame(Graphics *graphics) override final A_NONNULL(2);
+ void safeDrawFrame(Graphics *const graphics) override final
+ A_NONNULL(2);
Being *getBeing() A_WARN_UNUSED
{ return mBeing; }
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index bd94236b9..9a15bd6de 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -100,7 +100,7 @@ void Popup::setWindowContainer(WindowContainer *const wc)
windowContainer = wc;
}
-void Popup::draw(Graphics *graphics)
+void Popup::draw(Graphics *const graphics)
{
BLOCK_START("Popup::draw")
@@ -124,7 +124,7 @@ void Popup::draw(Graphics *graphics)
BLOCK_END("Popup::draw")
}
-void Popup::safeDraw(Graphics *graphics)
+void Popup::safeDraw(Graphics *const graphics)
{
BLOCK_START("Popup::safeDraw")
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index 60de2f264..bf09e4a51 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -76,9 +76,9 @@ class Popup notfinal : public Container,
/**
* Draws the popup.
*/
- void draw(Graphics *graphics) override A_NONNULL(2);
+ void draw(Graphics *const graphics) override A_NONNULL(2);
- void safeDraw(Graphics *graphics) override A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override A_NONNULL(2);
/**
* Sets the size of this popup.
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index a0fda7559..3d876b4cf 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -101,7 +101,7 @@ void PopupList::widgetResized(const Event &event)
adjustSize();
}
-void PopupList::setSelected(int selected)
+void PopupList::setSelected(const int selected)
{
if (!mListBox)
return;
diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h
index 8af5c4ce8..e6fa74d83 100644
--- a/src/gui/widgets/popuplist.h
+++ b/src/gui/widgets/popuplist.h
@@ -53,7 +53,7 @@ class PopupList final : public Popup,
void widgetResized(const Event &event) override final;
- void setSelected(int selected);
+ void setSelected(const int selected);
int getSelected() const;
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 455ccc31c..bb0824aaa 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -151,7 +151,7 @@ void ProgressBar::updateAlpha()
mAlpha = alpha;
}
-void ProgressBar::draw(Graphics *graphics)
+void ProgressBar::draw(Graphics *const graphics)
{
BLOCK_START("ProgressBar::draw")
if (!mSkin)
@@ -230,7 +230,7 @@ void ProgressBar::draw(Graphics *graphics)
BLOCK_END("ProgressBar::draw")
}
-void ProgressBar::safeDraw(Graphics *graphics)
+void ProgressBar::safeDraw(Graphics *const graphics)
{
BLOCK_START("ProgressBar::safeDraw")
if (!mSkin)
diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h
index c90940ebc..289633f3d 100644
--- a/src/gui/widgets/progressbar.h
+++ b/src/gui/widgets/progressbar.h
@@ -73,9 +73,9 @@ class ProgressBar final : public Widget,
/**
* Draws the progress bar.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Sets the current progress.
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index a01557217..7c633e377 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -32,7 +32,7 @@
#include "debug.h"
-ProgressIndicator::ProgressIndicator(Widget2 *const widget) :
+ProgressIndicator::ProgressIndicator(const Widget2 *const widget) :
Widget(widget),
mIndicator(nullptr)
{
@@ -42,8 +42,12 @@ ProgressIndicator::ProgressIndicator(Widget2 *const widget) :
if (images)
{
Animation *const anim = new Animation;
- for (ImageSet::size_type i = 0, sz = images->size(); i < sz; ++i)
- anim->addFrame(images->get(i), 100, 0, 0, 100);
+ for (ImageSet::size_type i = 0, fsz = images->size();
+ i < fsz;
+ ++i)
+ {
+ anim->addFrame(images->get(i), 100, 0, 0, 100);
+ }
mIndicator = new SimpleAnimation(anim);
images->decRef();
}
@@ -67,7 +71,7 @@ void ProgressIndicator::logic()
BLOCK_END("ProgressIndicator::logic")
}
-void ProgressIndicator::draw(Graphics *graphics)
+void ProgressIndicator::draw(Graphics *const graphics)
{
BLOCK_START("ProgressIndicator::draw")
if (mIndicator)
@@ -80,7 +84,7 @@ void ProgressIndicator::draw(Graphics *graphics)
BLOCK_END("ProgressIndicator::draw")
}
-void ProgressIndicator::safeDraw(Graphics *graphics)
+void ProgressIndicator::safeDraw(Graphics *const graphics)
{
BLOCK_START("ProgressIndicator::draw")
if (mIndicator)
diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h
index fec26dbcc..773750365 100644
--- a/src/gui/widgets/progressindicator.h
+++ b/src/gui/widgets/progressindicator.h
@@ -35,7 +35,7 @@ class SimpleAnimation;
class ProgressIndicator final : public Widget
{
public:
- explicit ProgressIndicator(Widget2 *const widget);
+ explicit ProgressIndicator(const Widget2 *const widget);
A_DELETE_COPY(ProgressIndicator)
@@ -43,9 +43,9 @@ class ProgressIndicator final : public Widget
void logic() override final;
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
private:
SimpleAnimation *mIndicator;
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 89b9b2341..d0583a7c8 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -177,7 +177,7 @@ void RadioButton::updateAlpha()
}
}
-void RadioButton::drawBox(Graphics* graphics)
+void RadioButton::drawBox(Graphics *const graphics)
{
if (!mSkin)
return;
@@ -222,7 +222,7 @@ void RadioButton::drawBox(Graphics* graphics)
}
}
-void RadioButton::draw(Graphics* graphics)
+void RadioButton::draw(Graphics *const graphics)
{
BLOCK_START("RadioButton::draw")
drawBox(graphics);
@@ -247,7 +247,7 @@ void RadioButton::draw(Graphics* graphics)
BLOCK_END("RadioButton::draw")
}
-void RadioButton::safeDraw(Graphics* graphics)
+void RadioButton::safeDraw(Graphics *const graphics)
{
RadioButton::draw(graphics);
}
diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h
index fe09ce921..79f1aefae 100644
--- a/src/gui/widgets/radiobutton.h
+++ b/src/gui/widgets/radiobutton.h
@@ -106,15 +106,15 @@ class RadioButton final : public Widget,
/**
* Draws the radiobutton, not the caption.
*/
- void drawBox(Graphics* graphics) A_NONNULL(2);
+ void drawBox(Graphics *const graphics) A_NONNULL(2);
/**
* Implementation of the draw methods.
* Thus, avoiding the rhomb around the radio button.
*/
- void draw(Graphics* graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics* graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Called when the mouse enteres the widget area.
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index d515f3c66..11a9905d4 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -311,7 +311,7 @@ void ScrollArea::updateAlpha()
}
}
-void ScrollArea::draw(Graphics *graphics)
+void ScrollArea::draw(Graphics *const graphics)
{
BLOCK_START("ScrollArea::draw")
if (mVBarVisible || mHBarVisible)
@@ -365,7 +365,7 @@ void ScrollArea::draw(Graphics *graphics)
BLOCK_END("ScrollArea::draw")
}
-void ScrollArea::safeDraw(Graphics *graphics)
+void ScrollArea::safeDraw(Graphics *const graphics)
{
BLOCK_START("ScrollArea::draw")
if (mVBarVisible)
@@ -423,7 +423,7 @@ void ScrollArea::updateCalcFlag(Graphics *const graphics)
}
}
-void ScrollArea::drawFrame(Graphics *graphics)
+void ScrollArea::drawFrame(Graphics *const graphics)
{
BLOCK_START("ScrollArea::drawFrame")
if (mOpaque)
@@ -448,7 +448,7 @@ void ScrollArea::drawFrame(Graphics *graphics)
BLOCK_END("ScrollArea::drawFrame")
}
-void ScrollArea::safeDrawFrame(Graphics *graphics)
+void ScrollArea::safeDrawFrame(Graphics *const graphics)
{
BLOCK_START("ScrollArea::drawFrame")
if (mOpaque)
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index 49c7617e3..cf02e0317 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -137,16 +137,17 @@ class ScrollArea final : public BasicContainer,
/**
* Draws the scroll area.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Draws the background and border of the scroll area.
*/
- void drawFrame(Graphics *graphics) override final A_NONNULL(2);
+ void drawFrame(Graphics *const graphics) override final A_NONNULL(2);
- void safeDrawFrame(Graphics *graphics) override final A_NONNULL(2);
+ void safeDrawFrame(Graphics *const graphics) override final
+ A_NONNULL(2);
/**
* Sets whether the widget should draw its background or not.
diff --git a/src/gui/widgets/serverslistbox.h b/src/gui/widgets/serverslistbox.h
index 444e70c9b..ff3262296 100644
--- a/src/gui/widgets/serverslistbox.h
+++ b/src/gui/widgets/serverslistbox.h
@@ -43,7 +43,7 @@ class ServersListBox final : public ListBox
mHighlightColor = getThemeColor(ThemeColorId::HIGHLIGHT);
}
- void draw(Graphics *graphics) override final A_NONNULL(2)
+ void draw(Graphics *const graphics) override final A_NONNULL(2)
{
if (!mListModel)
return;
@@ -140,7 +140,7 @@ class ServersListBox final : public ListBox
}
}
- void safeDraw(Graphics *graphics) override final A_NONNULL(2)
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2)
{
ServersListBox::draw(graphics);
}
diff --git a/src/gui/widgets/setupquickitem.cpp b/src/gui/widgets/setupquickitem.cpp
index f86a121c6..db7edabf7 100644
--- a/src/gui/widgets/setupquickitem.cpp
+++ b/src/gui/widgets/setupquickitem.cpp
@@ -32,8 +32,8 @@
SetupQuickItem::SetupQuickItem(const std::string &restrict description,
SetupTabScroll *restrict const parent,
const std::string &restrict eventName,
- ModifierGetFuncPtr getFunc,
- ModifierChangeFuncPtr changeFunc) :
+ const ModifierGetFuncPtr getFunc,
+ const ModifierChangeFuncPtr changeFunc) :
SetupItem("", description, "", parent, eventName, MainConfig_false),
mHorizont(nullptr),
mButton(nullptr),
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 6dd871825..2a515b2e9 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -79,7 +79,7 @@ void ShopListBox::setPlayersMoney(const int money)
mPlayerMoney = money;
}
-void ShopListBox::draw(Graphics *graphics)
+void ShopListBox::draw(Graphics *const graphics)
{
BLOCK_START("ShopListBox::draw")
if (!mListModel || !mShopItems)
@@ -177,7 +177,7 @@ void ShopListBox::draw(Graphics *graphics)
BLOCK_END("ShopListBox::draw")
}
-void ShopListBox::safeDraw(Graphics *graphics)
+void ShopListBox::safeDraw(Graphics *const graphics)
{
ShopListBox::draw(graphics);
}
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index cb02a7a90..cc4504c82 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -55,9 +55,9 @@ class ShopListBox final : public ListBox
/**
* Draws the list box.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* gives information about the current player's money
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index 8470d0b57..c173dc97e 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -118,7 +118,7 @@ int ShortcutContainer::getIndexFromGrid(const int pointX,
return index;
}
-void ShortcutContainer::drawBackground(Graphics *g)
+void ShortcutContainer::drawBackground(Graphics *const g)
{
if (mBackgroundImg)
{
@@ -138,7 +138,7 @@ void ShortcutContainer::drawBackground(Graphics *g)
}
}
-void ShortcutContainer::safeDrawBackground(Graphics *g)
+void ShortcutContainer::safeDrawBackground(Graphics *const g)
{
if (mBackgroundImg)
{
diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h
index a87a7cef7..d56f74f6f 100644
--- a/src/gui/widgets/shortcutcontainer.h
+++ b/src/gui/widgets/shortcutcontainer.h
@@ -86,9 +86,9 @@ class ShortcutContainer notfinal : public Widget,
int getBoxHeight() const A_WARN_UNUSED
{ return mBoxHeight; }
- void drawBackground(Graphics *g) A_NONNULL(2);
+ void drawBackground(Graphics *const g) A_NONNULL(2);
- void safeDrawBackground(Graphics *g) A_NONNULL(2);
+ void safeDrawBackground(Graphics *const g) A_NONNULL(2);
protected:
/**
diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h
index e0d1b2d91..41994e10a 100644
--- a/src/gui/widgets/skilllistbox.h
+++ b/src/gui/widgets/skilllistbox.h
@@ -85,7 +85,7 @@ class SkillListBox final : public ListBox
return static_cast<SkillModel*>(mListModel)->getSkillAt(selected);
}
- void draw(Graphics *graphics) override final A_NONNULL(2)
+ void draw(Graphics *const graphics) override final A_NONNULL(2)
{
if (!mListModel)
return;
@@ -169,7 +169,7 @@ class SkillListBox final : public ListBox
}
}
- void safeDraw(Graphics *graphics) override final A_NONNULL(2)
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2)
{
SkillListBox::draw(graphics);
}
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index d642354bc..f885b5e7d 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -185,7 +185,7 @@ void Slider::updateAlpha()
}
}
-void Slider::draw(Graphics *graphics)
+void Slider::draw(Graphics *const graphics)
{
BLOCK_START("Slider::draw")
if (!buttons[0].grid[HSTART] || !buttons[1].grid[HSTART]
@@ -283,7 +283,7 @@ void Slider::draw(Graphics *graphics)
BLOCK_END("Slider::draw")
}
-void Slider::safeDraw(Graphics *graphics)
+void Slider::safeDraw(Graphics *const graphics)
{
BLOCK_START("Slider::draw")
if (!buttons[0].grid[HSTART] || !buttons[1].grid[HSTART]
diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h
index 87e788098..db3dc346c 100644
--- a/src/gui/widgets/slider.h
+++ b/src/gui/widgets/slider.h
@@ -125,9 +125,9 @@ class Slider final : public Widget,
/**
* Draws the slider.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Called when the mouse enteres the widget area.
diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp
index dc2cba7b8..0d4332d85 100644
--- a/src/gui/widgets/sliderlist.cpp
+++ b/src/gui/widgets/sliderlist.cpp
@@ -107,7 +107,7 @@ void SliderList::resize()
updateLabel();
}
-void SliderList::draw(Graphics *graphics)
+void SliderList::draw(Graphics *const graphics)
{
BLOCK_START("SliderList::draw")
const int width = mDimension.width;
@@ -120,7 +120,7 @@ void SliderList::draw(Graphics *graphics)
BLOCK_END("SliderList::draw")
}
-void SliderList::safeDraw(Graphics *graphics)
+void SliderList::safeDraw(Graphics *const graphics)
{
BLOCK_START("SliderList::draw")
const int width = mDimension.width;
diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h
index 6289d381a..622fa95dc 100644
--- a/src/gui/widgets/sliderlist.h
+++ b/src/gui/widgets/sliderlist.h
@@ -55,9 +55,9 @@ class SliderList final : public Container,
void resize();
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void action(const ActionEvent &event) override final;
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 4b67977dd..db257ecd8 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -63,7 +63,7 @@ void SpellShortcutContainer::setWidget2(const Widget2 *const widget)
mForegroundColor2 = getThemeColor(ThemeColorId::TEXT_OUTLINE);
}
-void SpellShortcutContainer::draw(Graphics *graphics)
+void SpellShortcutContainer::draw(Graphics *const graphics)
{
if (!spellShortcut)
return;
@@ -123,7 +123,7 @@ void SpellShortcutContainer::draw(Graphics *graphics)
BLOCK_END("SpellShortcutContainer::draw")
}
-void SpellShortcutContainer::safeDraw(Graphics *graphics)
+void SpellShortcutContainer::safeDraw(Graphics *const graphics)
{
if (!spellShortcut)
return;
diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h
index 2ba25f551..3a044a79f 100644
--- a/src/gui/widgets/spellshortcutcontainer.h
+++ b/src/gui/widgets/spellshortcutcontainer.h
@@ -49,9 +49,9 @@ class SpellShortcutContainer final : public ShortcutContainer
/**
* Draws the items.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Handles mouse when dragged.
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index aea5bf252..2d1acc5fc 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -175,7 +175,7 @@ Tab *TabbedArea::getTab(const std::string &name) const
return nullptr;
}
-void TabbedArea::draw(Graphics *graphics)
+void TabbedArea::draw(Graphics *const graphics)
{
BLOCK_START("TabbedArea::draw")
if (mTabs.empty())
@@ -188,7 +188,7 @@ void TabbedArea::draw(Graphics *graphics)
BLOCK_END("TabbedArea::draw")
}
-void TabbedArea::safeDraw(Graphics *graphics)
+void TabbedArea::safeDraw(Graphics *const graphics)
{
BLOCK_START("TabbedArea::draw")
if (mTabs.empty())
@@ -421,8 +421,9 @@ void TabbedArea::setSelectedTab(Tab *const tab)
int TabbedArea::getSelectedTabIndex() const
{
- for (unsigned int i = 0, sz = CAST_U32(mTabs.size());
- i < sz; i++)
+ for (unsigned int i = 0, fsz = CAST_U32(mTabs.size());
+ i < fsz;
+ i++)
{
if (mTabs[i].first == mSelectedTab)
return i;
@@ -709,24 +710,28 @@ void TabbedArea::removeAll(const bool del)
void TabbedArea::setWidth(int width)
{
+ // +++ need use virtual
Widget::setWidth(width);
adjustSize();
}
void TabbedArea::setHeight(int height)
{
+ // +++ need use virtual
Widget::setHeight(height);
adjustSize();
}
void TabbedArea::setSize(int width, int height)
{
+ // +++ need use virtual
Widget::setSize(width, height);
adjustSize();
}
void TabbedArea::setDimension(const Rect &dimension)
{
+ // +++ need use virtual
Widget::setDimension(dimension);
adjustSize();
}
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index c14fb837f..083f178f7 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -102,9 +102,9 @@ class TabbedArea final : public ActionListener,
/**
* Draw the tabbed area.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Return how many tabs have been created.
diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp
index 93d2c72d8..7f5c26c8f 100644
--- a/src/gui/widgets/tabs/tab.cpp
+++ b/src/gui/widgets/tabs/tab.cpp
@@ -204,7 +204,7 @@ void Tab::updateAlpha()
}
}
-void Tab::draw(Graphics *graphics)
+void Tab::draw(Graphics *const graphics)
{
BLOCK_START("Tab::draw")
int mode = TAB_STANDARD;
@@ -307,7 +307,7 @@ void Tab::draw(Graphics *graphics)
BLOCK_END("Tab::draw")
}
-void Tab::safeDraw(Graphics *graphics)
+void Tab::safeDraw(Graphics *const graphics)
{
BLOCK_START("Tab::draw")
int mode = TAB_STANDARD;
diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h
index dfa126b90..d32cc176c 100644
--- a/src/gui/widgets/tabs/tab.h
+++ b/src/gui/widgets/tabs/tab.h
@@ -109,9 +109,9 @@ class Tab notfinal : public BasicContainer,
/**
* Draw the tabbed area.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Set the normal color for the tab's text.
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 8478e767e..d1c10be67 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -437,7 +437,7 @@ void TextBox::keyPressed(KeyEvent& event)
event.consume();
}
-void TextBox::draw(Graphics* graphics)
+void TextBox::draw(Graphics *const graphics)
{
BLOCK_START("TextBox::draw")
if (mOpaque)
@@ -468,7 +468,7 @@ void TextBox::draw(Graphics* graphics)
BLOCK_END("TextBox::draw")
}
-void TextBox::safeDraw(Graphics* graphics)
+void TextBox::safeDraw(Graphics *const graphics)
{
TextBox::draw(graphics);
}
@@ -514,8 +514,9 @@ void TextBox::setTextRow(const int row, const std::string& text)
void TextBox::setCaretPosition(unsigned int position)
{
- for (int row = 0, sz = CAST_S32(mTextRows.size());
- row < sz; row ++)
+ for (int row = 0, fsz = CAST_S32(mTextRows.size());
+ row < fsz;
+ row ++)
{
if (position <= mTextRows[row].size())
{
@@ -619,7 +620,9 @@ void TextBox::mouseDragged(MouseEvent& event)
event.consume();
}
-void TextBox::drawCaret(Graphics *const graphics, const int x, const int y)
+void TextBox::drawCaret(Graphics *const graphics,
+ const int x,
+ const int y) const
{
graphics->setColor(mForegroundColor);
graphics->drawLine(x, getFont()->getHeight() + y, x, y);
diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h
index bdeca3c5d..10a76c85d 100644
--- a/src/gui/widgets/textbox.h
+++ b/src/gui/widgets/textbox.h
@@ -107,9 +107,9 @@ class TextBox final : public Widget,
void keyPressed(KeyEvent& event) override final;
- void draw(Graphics* graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics* graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void setForegroundColor(const Color &color);
@@ -289,7 +289,7 @@ class TextBox final : public Widget,
*/
void drawCaret(Graphics *const graphics,
const int x,
- const int y) A_NONNULL(2);
+ const int y) const A_NONNULL(2);
/**
* Adjusts the text box's size to fit the text.
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 291a5fa22..f9fec2852 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -197,7 +197,7 @@ void TextField::updateAlpha()
}
}
-void TextField::draw(Graphics *graphics)
+void TextField::draw(Graphics *const graphics)
{
BLOCK_START("TextField::draw")
updateAlpha();
@@ -227,12 +227,12 @@ void TextField::draw(Graphics *graphics)
BLOCK_END("TextField::draw")
}
-void TextField::safeDraw(Graphics *graphics)
+void TextField::safeDraw(Graphics *const graphics)
{
TextField::draw(graphics);
}
-void TextField::drawFrame(Graphics *graphics)
+void TextField::drawFrame(Graphics *const graphics)
{
BLOCK_START("TextField::drawFrame")
const int bs = 2 * mFrameSize;
@@ -244,7 +244,7 @@ void TextField::drawFrame(Graphics *graphics)
BLOCK_END("TextField::drawFrame")
}
-void TextField::safeDrawFrame(Graphics *graphics)
+void TextField::safeDrawFrame(Graphics *const graphics)
{
BLOCK_START("TextField::drawFrame")
const int bs = 2 * mFrameSize;
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index 90fb0b571..89606d27c 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -107,9 +107,9 @@ class TextField notfinal : public Widget,
/**
* Draws the text field.
*/
- void draw(Graphics *graphics) override A_NONNULL(2);
+ void draw(Graphics *const graphics) override A_NONNULL(2);
- void safeDraw(Graphics *graphics) override A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override A_NONNULL(2);
/**
* Update the alpha value to the graphic components.
@@ -119,9 +119,10 @@ class TextField notfinal : public Widget,
/**
* Draws the background and border.
*/
- void drawFrame(Graphics *graphics) override final A_NONNULL(2);
+ void drawFrame(Graphics *const graphics) override final A_NONNULL(2);
- void safeDrawFrame(Graphics *graphics) override final A_NONNULL(2);
+ void safeDrawFrame(Graphics *const graphics) override final
+ A_NONNULL(2);
/**
* Determine whether the field should be numeric or not
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 6e61a16a5..63b26e444 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -79,7 +79,7 @@ TextPreview::~TextPreview()
}
}
-void TextPreview::draw(Graphics* graphics)
+void TextPreview::draw(Graphics *const graphics)
{
if (!mFont)
return;
@@ -138,7 +138,7 @@ void TextPreview::draw(Graphics* graphics)
BLOCK_END("TextPreview::draw")
}
-void TextPreview::safeDraw(Graphics* graphics)
+void TextPreview::safeDraw(Graphics *const graphics)
{
TextPreview::draw(graphics);
}
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index 01953b9c1..e32b911e7 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -100,9 +100,9 @@ class TextPreview final : public Widget
*
* @param graphics graphics to draw into
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Set opacity for this widget (whether or not to show the background
diff --git a/src/gui/widgets/virtshortcutcontainer.cpp b/src/gui/widgets/virtshortcutcontainer.cpp
index c57722596..7ed1eb0d1 100644
--- a/src/gui/widgets/virtshortcutcontainer.cpp
+++ b/src/gui/widgets/virtshortcutcontainer.cpp
@@ -71,7 +71,7 @@ void VirtShortcutContainer::setWidget2(const Widget2 *const widget)
mUnEquipedColor2 = getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED_OUTLINE);
}
-void VirtShortcutContainer::draw(Graphics *graphics)
+void VirtShortcutContainer::draw(Graphics *const graphics)
{
if (!mShortcut)
return;
@@ -145,7 +145,7 @@ void VirtShortcutContainer::draw(Graphics *graphics)
BLOCK_END("VirtShortcutContainer::draw")
}
-void VirtShortcutContainer::safeDraw(Graphics *graphics)
+void VirtShortcutContainer::safeDraw(Graphics *const graphics)
{
if (!mShortcut)
return;
diff --git a/src/gui/widgets/virtshortcutcontainer.h b/src/gui/widgets/virtshortcutcontainer.h
index e93abfdc0..a8ee392f9 100644
--- a/src/gui/widgets/virtshortcutcontainer.h
+++ b/src/gui/widgets/virtshortcutcontainer.h
@@ -51,9 +51,9 @@ class VirtShortcutContainer final : public ShortcutContainer
/**
* Draws the items.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
/**
* Handles mouse when dragged.
diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp
index 71f9d1260..1ddd2c120 100644
--- a/src/gui/widgets/widget.cpp
+++ b/src/gui/widgets/widget.cpp
@@ -353,7 +353,7 @@ void Widget::distributeWindowResizeEvent()
(*iter)->windowResized();
}
-bool Widget::widgetExists(const Widget* widget)
+bool Widget::widgetExists(const Widget *const widget)
{
return mWidgetsSet.find(const_cast<Widget*>(widget))
!= mWidgetsSet.end();
diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h
index e69e1c061..b94f81251 100644
--- a/src/gui/widgets/widget.h
+++ b/src/gui/widgets/widget.h
@@ -121,9 +121,9 @@ class Widget notfinal : public Widget2
* @param graphics aA graphics object to draw with.
* @since 0.1.0
*/
- virtual void draw(Graphics* graphics) A_NONNULL(2) = 0;
+ virtual void draw(Graphics *const graphics) A_NONNULL(2) = 0;
- virtual void safeDraw(Graphics* graphics) A_NONNULL(2) = 0;
+ virtual void safeDraw(Graphics *const graphics) A_NONNULL(2) = 0;
/**
* Called when a widget is given a chance to draw a frame around itself.
@@ -721,7 +721,7 @@ class Widget notfinal : public Widget2
* @return True if an instance of the widget exists, false otherwise.
* @since 0.1.0
*/
- static bool widgetExists(const Widget* widget) A_WARN_UNUSED;
+ static bool widgetExists(const Widget *const widget) A_WARN_UNUSED;
/**
* Checks if tab in is enabled. Tab in means that you can set focus
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 886372035..9de9b431f 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -287,7 +287,7 @@ void Window::setWindowContainer(WindowContainer *const wc)
windowContainer = wc;
}
-void Window::draw(Graphics *graphics)
+void Window::draw(Graphics *const graphics)
{
if (!mSkin)
return;
@@ -399,7 +399,7 @@ void Window::draw(Graphics *graphics)
BLOCK_END("Window::draw")
}
-void Window::safeDraw(Graphics *graphics)
+void Window::safeDraw(Graphics *const graphics)
{
if (!mSkin)
return;
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 22378b59a..c5bcb2215 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -128,9 +128,9 @@ class Window notfinal : public BasicContainer2,
/**
* Draws the window.
*/
- void draw(Graphics *graphics) override A_NONNULL(2);
+ void draw(Graphics *const graphics) override A_NONNULL(2);
- void safeDraw(Graphics *graphics) override A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override A_NONNULL(2);
/**
* Sets the size of this window.
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index 830224602..b3f01d0fe 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -95,7 +95,7 @@ void WindowContainer::moveWidgetAfter(Widget *const after,
}
#ifdef USE_PROFILER
-void WindowContainer::draw(Graphics* graphics)
+void WindowContainer::draw(Graphics *const graphics)
{
BLOCK_START("WindowContainer::draw")
Container::draw(graphics);
diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h
index 61fc04ce2..cc9b3c814 100644
--- a/src/gui/widgets/windowcontainer.h
+++ b/src/gui/widgets/windowcontainer.h
@@ -55,7 +55,7 @@ class WindowContainer notfinal : public Container
Widget *const widget);
#ifdef USE_PROFILER
- void draw(Graphics* graphics) override A_NONNULL(2);
+ void draw(Graphics *const graphics) override A_NONNULL(2);
#endif
private:
diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp
index ca880df2a..4748fd713 100644
--- a/src/gui/windowmanager.cpp
+++ b/src/gui/windowmanager.cpp
@@ -180,8 +180,8 @@ int WindowManager::getFramerate()
return SDL_getFramerate(&fpsManager);
}
-void WindowManager::doResizeVideo(int actualWidth,
- int actualHeight,
+void WindowManager::doResizeVideo(const int actualWidth,
+ const int actualHeight,
const bool always)
{
if (!always
diff --git a/src/gui/windowmanager.h b/src/gui/windowmanager.h
index a64478bb5..b100288fc 100644
--- a/src/gui/windowmanager.h
+++ b/src/gui/windowmanager.h
@@ -49,8 +49,8 @@ namespace WindowManager
void applyKeyRepeat();
- void doResizeVideo(int actualWidth,
- int actualHeight,
+ void doResizeVideo(const int actualWidth,
+ const int actualHeight,
const bool always);
void resizeVideo(int actualWidth,
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index ec51062eb..7360b4a5e 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -208,7 +208,7 @@ WindowMenu::~WindowMenu()
for (std::map <std::string, ButtonInfo*>::iterator
it = mButtonNames.begin(),
- it_end = mButtonNames.end(); it != it_end; ++it)
+ it_fend = mButtonNames.end(); it != it_fend; ++it)
{
delete (*it).second;
}
@@ -382,7 +382,7 @@ void WindowMenu::loadButtons()
{
for (std::map <std::string, ButtonInfo*>::iterator
it = mButtonNames.begin(),
- it_end = mButtonNames.end(); it != it_end; ++it)
+ it_fend = mButtonNames.end(); it != it_fend; ++it)
{
const ButtonInfo *const info = (*it).second;
if (!info || !info->button || info->visible == Visible_true)
@@ -409,7 +409,7 @@ void WindowMenu::loadButtons()
{
for (std::map <std::string, ButtonInfo*>::iterator
it = mButtonNames.begin(),
- it_end = mButtonNames.end(); it != it_end; ++it)
+ it_fend = mButtonNames.end(); it != it_fend; ++it)
{
const ButtonInfo *const info = (*it).second;
if (!info || !info->button)
@@ -440,7 +440,7 @@ void WindowMenu::saveButtons() const
config.deleteKey("windowmenu" + toString(f));
}
-void WindowMenu::drawChildren(Graphics* graphics)
+void WindowMenu::drawChildren(Graphics *const graphics)
{
if (mHaveMouse || !mAutoHide || (mAutoHide == 1
&& mainGraphics && (mSmallWindow || mainGraphics->mWidth > 800)))
@@ -449,7 +449,7 @@ void WindowMenu::drawChildren(Graphics* graphics)
}
}
-void WindowMenu::safeDrawChildren(Graphics* graphics)
+void WindowMenu::safeDrawChildren(Graphics *const graphics)
{
if (mHaveMouse || !mAutoHide || (mAutoHide == 1
&& mainGraphics && (mSmallWindow || mainGraphics->mWidth > 800)))
diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h
index 88778040c..cf9d701f7 100644
--- a/src/gui/windowmenu.h
+++ b/src/gui/windowmenu.h
@@ -87,9 +87,11 @@ class WindowMenu final : public Container,
#endif
protected:
- void drawChildren(Graphics* graphics) override final A_NONNULL(2);
+ void drawChildren(Graphics *const graphics) override final
+ A_NONNULL(2);
- void safeDrawChildren(Graphics* graphics) override final A_NONNULL(2);
+ void safeDrawChildren(Graphics *const graphics) override final
+ A_NONNULL(2);
private:
inline void addButton(const char *const text,
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 82f49421b..47ec11db2 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -566,7 +566,8 @@ void BuyDialog::action(const ActionEvent &event)
#ifdef EATHENA_SUPPORT
if (serverFeatures->haveVending())
{
- Being *const being = actorManager->findBeingByName(mNick);
+ const Being *const being = actorManager->findBeingByName(
+ mNick);
if (being)
{
vendingHandler->buy(being,
diff --git a/src/gui/windows/buyingstoreselldialog.cpp b/src/gui/windows/buyingstoreselldialog.cpp
index 205734248..7cb6f975a 100644
--- a/src/gui/windows/buyingstoreselldialog.cpp
+++ b/src/gui/windows/buyingstoreselldialog.cpp
@@ -52,13 +52,13 @@ void BuyingStoreSellDialog::sellAction(const ActionEvent &event A_UNUSED)
return;
const int selectedItem = mShopItemList->getSelected();
- ShopItem *const item1 = mShopItems->at(selectedItem);
+ const ShopItem *const item1 = mShopItems->at(selectedItem);
if (!item1 || PlayerInfo::isItemProtected(item1->getId()))
return;
- Being *const being = actorManager->findBeing(mAccountId);
+ const Being *const being = actorManager->findBeing(mAccountId);
if (!being)
return;
- Item *const item2 = PlayerInfo::getInventory()->findItem(
+ const Item *const item2 = PlayerInfo::getInventory()->findItem(
item1->getId(),
item1->getColor());
if (!item2)
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 420d20c1c..f9500465d 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -150,8 +150,9 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
const std::vector<int> &items = CharDB::getDefaultItems();
int i = 1;
for (std::vector<int>::const_iterator it = items.begin(),
- it_end = items.end();
- it != it_end; ++ it, i ++)
+ it_fend = items.end();
+ it != it_fend;
+ ++ it, i ++)
{
mPlayer->setSprite(i, *it);
}
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 57cc7ceb5..19a61cc10 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -183,8 +183,10 @@ void CharSelectDialog::action(const ActionEvent &event)
// Check if a button of a character was pressed
const Widget *const sourceParent = event.getSource()->getParent();
int selected = -1;
- for (unsigned int i = 0, sz = CAST_U32(
- mCharacterEntries.size()); i < sz; ++i)
+ for (unsigned int i = 0, fsz = CAST_U32(
+ mCharacterEntries.size());
+ i < fsz;
+ ++i)
{
if (mCharacterEntries[i] == sourceParent)
{
@@ -616,8 +618,10 @@ void CharSelectDialog::updateState()
void CharSelectDialog::setName(const BeingId id, const std::string &newName)
{
- for (unsigned int i = 0, sz = CAST_U32(
- mCharacterEntries.size()); i < sz; ++i)
+ for (unsigned int i = 0, fsz = CAST_U32(
+ mCharacterEntries.size());
+ i < fsz;
+ ++i)
{
if (!mCharacterEntries[i])
continue;
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 5be54a6f9..d5c2677ac 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -2087,7 +2087,7 @@ void ChatWindow::mouseExited(MouseEvent& event)
Window::mouseExited(event);
}
-void ChatWindow::draw(Graphics* graphics)
+void ChatWindow::draw(Graphics *const graphics)
{
BLOCK_START("ChatWindow::draw")
if (!mAutoHide || mHaveMouse)
@@ -2099,7 +2099,7 @@ void ChatWindow::draw(Graphics* graphics)
BLOCK_END("ChatWindow::draw")
}
-void ChatWindow::safeDraw(Graphics* graphics)
+void ChatWindow::safeDraw(Graphics *const graphics)
{
BLOCK_START("ChatWindow::draw")
if (!mAutoHide || mHaveMouse)
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 644134158..aec0846ad 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -279,9 +279,9 @@ class ChatWindow final : public Window,
void mouseExited(MouseEvent& event A_UNUSED) override final;
- void draw(Graphics* graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics* graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void updateVisibility();
diff --git a/src/gui/windows/connectiondialog.cpp b/src/gui/windows/connectiondialog.cpp
index ccefa59ba..290a1cefe 100644
--- a/src/gui/windows/connectiondialog.cpp
+++ b/src/gui/windows/connectiondialog.cpp
@@ -73,7 +73,7 @@ void ConnectionDialog::action(const ActionEvent &)
client->setState(mCancelState);
}
-void ConnectionDialog::draw(Graphics *graphics)
+void ConnectionDialog::draw(Graphics *const graphics)
{
BLOCK_START("ConnectionDialog::draw")
// Don't draw the window background, only draw the children
@@ -81,7 +81,7 @@ void ConnectionDialog::draw(Graphics *graphics)
BLOCK_END("ConnectionDialog::draw")
}
-void ConnectionDialog::safeDraw(Graphics *graphics)
+void ConnectionDialog::safeDraw(Graphics *const graphics)
{
BLOCK_START("ConnectionDialog::draw")
// Don't draw the window background, only draw the children
diff --git a/src/gui/windows/connectiondialog.h b/src/gui/windows/connectiondialog.h
index a53a84151..5630ee121 100644
--- a/src/gui/windows/connectiondialog.h
+++ b/src/gui/windows/connectiondialog.h
@@ -58,9 +58,9 @@ class ConnectionDialog final : public Window,
*/
void action(const ActionEvent &) override final;
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
private:
StateT mCancelState;
diff --git a/src/gui/windows/cutinwindow.cpp b/src/gui/windows/cutinwindow.cpp
index 571030407..184695260 100644
--- a/src/gui/windows/cutinwindow.cpp
+++ b/src/gui/windows/cutinwindow.cpp
@@ -55,13 +55,13 @@ CutInWindow::~CutInWindow()
delete2(mImage);
}
-void CutInWindow::draw(Graphics *graphics)
+void CutInWindow::draw(Graphics *const graphics)
{
Window::draw(graphics);
draw2(graphics);
}
-void CutInWindow::safeDraw(Graphics *graphics)
+void CutInWindow::safeDraw(Graphics *const graphics)
{
Window::safeDraw(graphics);
draw2(graphics);
diff --git a/src/gui/windows/cutinwindow.h b/src/gui/windows/cutinwindow.h
index f6e48624c..fd6e63390 100644
--- a/src/gui/windows/cutinwindow.h
+++ b/src/gui/windows/cutinwindow.h
@@ -38,9 +38,9 @@ class CutInWindow final : public Window
~CutInWindow();
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void draw2(Graphics *const graphics) A_NONNULL(2);
diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp
index add7d2e4d..3c0c60b0f 100644
--- a/src/gui/windows/debugwindow.cpp
+++ b/src/gui/windows/debugwindow.cpp
@@ -116,7 +116,7 @@ void DebugWindow::slowLogic()
BLOCK_END("DebugWindow::slowLogic")
}
-void DebugWindow::draw(Graphics *g)
+void DebugWindow::draw(Graphics *const g)
{
BLOCK_START("DebugWindow::draw")
Window::draw(g);
@@ -134,7 +134,7 @@ void DebugWindow::draw(Graphics *g)
BLOCK_END("DebugWindow::draw")
}
-void DebugWindow::safeDraw(Graphics *g)
+void DebugWindow::safeDraw(Graphics *const g)
{
BLOCK_START("DebugWindow::draw")
Window::safeDraw(g);
diff --git a/src/gui/windows/debugwindow.h b/src/gui/windows/debugwindow.h
index 00ed46e48..12bb97f13 100644
--- a/src/gui/windows/debugwindow.h
+++ b/src/gui/windows/debugwindow.h
@@ -54,9 +54,9 @@ class DebugWindow final : public Window
*/
void slowLogic();
- void draw(Graphics *g) override final A_NONNULL(2);
+ void draw(Graphics *const g) override final A_NONNULL(2);
- void safeDraw(Graphics *g) override final A_NONNULL(2);
+ void safeDraw(Graphics *const g) override final A_NONNULL(2);
void setPing(int pingTime);
diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp
index 21216f2ae..1737010cc 100644
--- a/src/gui/windows/didyouknowwindow.cpp
+++ b/src/gui/windows/didyouknowwindow.cpp
@@ -134,7 +134,7 @@ void DidYouKnowWindow::action(const ActionEvent &event)
}
void DidYouKnowWindow::handleLink(const std::string &link,
- MouseEvent *event A_UNUSED)
+ MouseEvent *const event A_UNUSED)
{
if (strStartWith(link, "http://") || strStartWith(link, "https://"))
openBrowser(link);
diff --git a/src/gui/windows/didyouknowwindow.h b/src/gui/windows/didyouknowwindow.h
index 1b015acb3..c63b2d421 100644
--- a/src/gui/windows/didyouknowwindow.h
+++ b/src/gui/windows/didyouknowwindow.h
@@ -59,7 +59,7 @@ class DidYouKnowWindow final : public Window,
* Handles link action.
*/
void handleLink(const std::string &link,
- MouseEvent *event) override final;
+ MouseEvent *const event) override final;
void loadData(int num = 0);
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index ddde610eb..62feb6e7d 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -174,7 +174,7 @@ EquipmentWindow::~EquipmentWindow()
delete2(mVertexes);
}
-void EquipmentWindow::draw(Graphics *graphics)
+void EquipmentWindow::draw(Graphics *const graphics)
{
BLOCK_START("EquipmentWindow::draw")
// Draw window graphics
@@ -261,7 +261,7 @@ void EquipmentWindow::draw(Graphics *graphics)
BLOCK_END("EquipmentWindow::draw")
}
-void EquipmentWindow::safeDraw(Graphics *graphics)
+void EquipmentWindow::safeDraw(Graphics *const graphics)
{
BLOCK_START("EquipmentWindow::draw")
// Draw window graphics
diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h
index 4463c770c..985208e03 100644
--- a/src/gui/windows/equipmentwindow.h
+++ b/src/gui/windows/equipmentwindow.h
@@ -70,9 +70,9 @@ class EquipmentWindow final : public Window,
/**
* Draws the equipment window.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void action(const ActionEvent &event) override final;
diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp
index 50e5423ac..63123d56b 100644
--- a/src/gui/windows/helpwindow.cpp
+++ b/src/gui/windows/helpwindow.cpp
@@ -102,7 +102,7 @@ void HelpWindow::action(const ActionEvent &event)
}
void HelpWindow::handleLink(const std::string &link,
- MouseEvent *event A_UNUSED)
+ MouseEvent *const event A_UNUSED)
{
if (!strStartWith(link, "http://") && !strStartWith(link, "https://"))
{
diff --git a/src/gui/windows/helpwindow.h b/src/gui/windows/helpwindow.h
index a636b8b0f..ec0b88d93 100644
--- a/src/gui/windows/helpwindow.h
+++ b/src/gui/windows/helpwindow.h
@@ -62,7 +62,7 @@ class HelpWindow final : public Window,
* Handles link action.
*/
void handleLink(const std::string &link,
- MouseEvent *event A_UNUSED) override final;
+ MouseEvent *const event A_UNUSED) override final;
/**
* Loads help in the dialog.
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 2d7b8ba65..371d98414 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -237,7 +237,7 @@ void Minimap::toggle()
mShow = isWindowVisible();
}
-void Minimap::draw(Graphics *graphics)
+void Minimap::draw(Graphics *const graphics)
{
BLOCK_START("Minimap::draw")
@@ -245,7 +245,7 @@ void Minimap::draw(Graphics *graphics)
draw2(graphics);
}
-void Minimap::safeDraw(Graphics *graphics)
+void Minimap::safeDraw(Graphics *const graphics)
{
BLOCK_START("Minimap::draw")
diff --git a/src/gui/windows/minimap.h b/src/gui/windows/minimap.h
index 60486e692..7d6f8bfc4 100644
--- a/src/gui/windows/minimap.h
+++ b/src/gui/windows/minimap.h
@@ -59,9 +59,9 @@ class Minimap final : public Window, public ConfigListener
/**
* Draws the minimap.
*/
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void draw2(Graphics *const graphics) A_NONNULL(2);
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index e0fe46bb3..b8e321dcf 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -317,14 +317,14 @@ void MiniStatusWindow::logic()
BLOCK_END("MiniStatusWindow::logic")
}
-void MiniStatusWindow::draw(Graphics *graphics)
+void MiniStatusWindow::draw(Graphics *const graphics)
{
BLOCK_START("MiniStatusWindow::draw")
drawChildren(graphics);
BLOCK_END("MiniStatusWindow::draw")
}
-void MiniStatusWindow::safeDraw(Graphics *graphics)
+void MiniStatusWindow::safeDraw(Graphics *const graphics)
{
BLOCK_START("MiniStatusWindow::draw")
safeDrawChildren(graphics);
diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h
index bdf4dcd29..82fa059c7 100644
--- a/src/gui/windows/ministatuswindow.h
+++ b/src/gui/windows/ministatuswindow.h
@@ -69,9 +69,9 @@ class MiniStatusWindow final : public Window,
void logic() override final;
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void mouseMoved(MouseEvent &event) override final;
diff --git a/src/gui/windows/npcselldialog.cpp b/src/gui/windows/npcselldialog.cpp
index 6822c3ed6..453126382 100644
--- a/src/gui/windows/npcselldialog.cpp
+++ b/src/gui/windows/npcselldialog.cpp
@@ -56,7 +56,7 @@ void NpcSellDialog::sellAction(const ActionEvent &event)
{
const std::string &eventId = event.getId();
const int selectedItem = mShopItemList->getSelected();
- ShopItem *const item = mShopItems->at(selectedItem);
+ const ShopItem *const item = mShopItems->at(selectedItem);
if (!item || PlayerInfo::isItemProtected(item->getId()))
return;
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index 83874f4c3..0e5885089 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -324,7 +324,7 @@ void OutfitWindow::copyOutfit(const int src, const int dst)
save();
}
-void OutfitWindow::draw(Graphics *graphics)
+void OutfitWindow::draw(Graphics *const graphics)
{
BLOCK_START("OutfitWindow::draw")
Window::draw(graphics);
@@ -380,7 +380,7 @@ void OutfitWindow::draw(Graphics *graphics)
BLOCK_END("OutfitWindow::draw")
}
-void OutfitWindow::safeDraw(Graphics *graphics)
+void OutfitWindow::safeDraw(Graphics *const graphics)
{
BLOCK_START("OutfitWindow::draw")
Window::safeDraw(graphics);
diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h
index 1dc30955b..b10388005 100644
--- a/src/gui/windows/outfitwindow.h
+++ b/src/gui/windows/outfitwindow.h
@@ -54,9 +54,9 @@ class OutfitWindow final : public Window,
void action(const ActionEvent &event) override final;
- void draw(Graphics *graphics) override final A_NONNULL(2);
+ void draw(Graphics *const graphics) override final A_NONNULL(2);
- void safeDraw(Graphics *graphics) override final A_NONNULL(2);
+ void safeDraw(Graphics *const graphics) override final A_NONNULL(2);
void mousePressed(MouseEvent &event) override final;
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index f4cd045c3..b52793f05 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -570,8 +570,8 @@ void ServerDialog::loadServers(const bool addNew)
MutexLocker tempLock(&mMutex);
// Add the server to the local list if it's not already present
bool found = false;
- for (unsigned int i = 0, sz = CAST_U32(
- mServers.size()); i < sz; i++)
+ for (unsigned int i = 0, fsz = CAST_U32(
+ mServers.size()); i < fsz; i++)
{
if (mServers[i] == server)
{
@@ -660,8 +660,8 @@ void ServerDialog::saveCustomServers(const ServerInfo &currentServer,
int savedServerCount = 0;
- for (unsigned i = 0, sz = CAST_U32(mServers.size());
- i < sz && savedServerCount < MAX_SERVERLIST; ++ i)
+ for (unsigned i = 0, fsz = CAST_U32(mServers.size());
+ i < fsz && savedServerCount < MAX_SERVERLIST; ++ i)
{
const ServerInfo &server = mServers.at(i);
@@ -695,9 +695,9 @@ void ServerDialog::saveCustomServers(const ServerInfo &currentServer,
}
int ServerDialog::downloadUpdate(void *ptr,
- DownloadStatusT status,
+ const DownloadStatusT status,
size_t total,
- size_t remaining)
+ const size_t remaining)
{
if (!ptr || status == DownloadStatus::Cancelled)
return -1;
diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h
index 6ef3e1cf0..348f1f1f0 100644
--- a/src/gui/windows/serverdialog.h
+++ b/src/gui/windows/serverdialog.h
@@ -119,9 +119,9 @@ class ServerDialog final : public Window,
bool needUpdateServers() const;
static int downloadUpdate(void *ptr,
- DownloadStatusT status,
+ const DownloadStatusT status,
size_t total,
- size_t remaining);
+ const size_t remaining);
Mutex mMutex;
ServerInfos mServers;
diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp
index b1fabc86f..353e228c2 100644
--- a/src/gui/windows/setupwindow.cpp
+++ b/src/gui/windows/setupwindow.cpp
@@ -106,7 +106,7 @@ void SetupWindow::postInit()
};
int x = width;
mButtonPadding = getOption("buttonPadding", 5);
- 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);
mButtons.push_back(btn);
@@ -226,7 +226,7 @@ void SetupWindow::externalUpdate()
}
}
-void SetupWindow::unloadTab(SetupTab *page)
+void SetupWindow::unloadTab(SetupTab *const page)
{
if (page)
{
diff --git a/src/gui/windows/setupwindow.h b/src/gui/windows/setupwindow.h
index 8568b1bfe..4e6d6b15c 100644
--- a/src/gui/windows/setupwindow.h
+++ b/src/gui/windows/setupwindow.h
@@ -78,7 +78,7 @@ class SetupWindow final : public Window,
private:
void unloadAdditionalTabs();
- void unloadTab(SetupTab *page);
+ void unloadTab(SetupTab *const page);
std::list<SetupTab*> mTabs;
std::list<Window*> mWindowsToReset;
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index b927273ef..679bbc47f 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -341,7 +341,7 @@ void ShopWindow::action(const ActionEvent &event)
{
std::vector<ShopItem*> &oldItems = mSellShopItems->items();
std::vector<ShopItem*> items;
- Inventory *const inv = PlayerInfo::getCartInventory();
+ const Inventory *const inv = PlayerInfo::getCartInventory();
if (!inv)
return;
FOR_EACH (std::vector<ShopItem*>::iterator, it, oldItems)
@@ -349,7 +349,7 @@ void ShopWindow::action(const ActionEvent &event)
ShopItem *const item = *it;
if (!item)
continue;
- Item *const cartItem = inv->findItem(item->getId(),
+ const Item *const cartItem = inv->findItem(item->getId(),
item->getColor());
if (!cartItem)
continue;
@@ -623,7 +623,9 @@ void ShopWindow::saveList() const
}
for (std::map<int, ShopItem*>::const_iterator mapIt = mapItems.begin(),
- mapIt_end = mapItems.end(); mapIt != mapIt_end; ++mapIt)
+ mapIt_fend = mapItems.end();
+ mapIt != mapIt_fend;
+ ++mapIt)
{
const ShopItem *const buyItem = (*mapIt).second;
if (buyItem)
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index 8498b6316..fe8aaacbf 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -660,7 +660,7 @@ void SocialWindow::updateParty()
Party *const party = localPlayer->getParty();
if (party)
{
- PartyMap::iterator it = mParties.find(party);
+ const PartyMap::iterator it = mParties.find(party);
if (it != mParties.end())
{
SocialTab *const tab = (*it).second;
@@ -694,7 +694,7 @@ void SocialWindow::updateGuildCounter(const int online, const int total)
Guild *const guild = localPlayer->getGuild();
if (guild)
{
- GuildMap::iterator it = mGuilds.find(guild);
+ const GuildMap::iterator it = mGuilds.find(guild);
if (it != mGuilds.end())
{
SocialTab *const tab = (*it).second;
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index fcc2cc8ec..27a8c658e 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -203,7 +203,7 @@ void TradeWindow::addItem(const int id,
const Damaged damaged,
const Favorite favorite) const
{
- Inventory *inv = own ? mMyInventory : mPartnerInventory;
+ Inventory *const inv = own ? mMyInventory : mPartnerInventory;
inv->addItem(id,
type,
quantity,
@@ -229,7 +229,7 @@ void TradeWindow::addItem2(const int id,
const Favorite favorite,
const Equipm equipment) const
{
- Inventory *inv = own ? mMyInventory : mPartnerInventory;
+ Inventory *const inv = own ? mMyInventory : mPartnerInventory;
const int slot = inv->addItem(id,
type,
quantity,
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 09f529259..242e32911 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -487,9 +487,9 @@ void UpdaterWindow::loadPatch()
}
int UpdaterWindow::updateProgress(void *ptr,
- DownloadStatusT status,
+ const DownloadStatusT status,
size_t dt,
- size_t dn)
+ const size_t dn)
{
UpdaterWindow *const uw = reinterpret_cast<UpdaterWindow *>(ptr);
if (!uw)
@@ -685,8 +685,10 @@ void UpdaterWindow::loadLocalUpdates(const std::string &dir)
}
const std::string fixPath = dir + "/fix";
- for (unsigned int updateIndex = 0, sz = CAST_U32(
- updateFiles.size()); updateIndex < sz; updateIndex ++)
+ for (unsigned int updateIndex = 0,
+ fsz = CAST_U32(updateFiles.size());
+ updateIndex < fsz;
+ updateIndex++)
{
const UpdateFile &file = updateFiles[updateIndex];
if (!file.group.empty())
@@ -712,8 +714,10 @@ void UpdaterWindow::unloadUpdates(const std::string &dir)
}
const std::string fixPath = dir + "/fix";
- for (unsigned int updateIndex = 0, sz = CAST_U32(
- updateFiles.size()); updateIndex < sz; updateIndex ++)
+ for (unsigned int updateIndex = 0,
+ fsz = CAST_U32(updateFiles.size());
+ updateIndex < fsz;
+ updateIndex++)
{
UpdaterWindow::removeUpdateFile(dir,
fixPath,
@@ -728,8 +732,10 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir)
std::vector<UpdateFile> updateFiles = loadXMLFile(
std::string(fixPath).append("/").append(xmlUpdateFile), false);
- for (unsigned int updateIndex = 0, sz = CAST_U32(
- updateFiles.size()); updateIndex < sz; updateIndex ++)
+ for (unsigned int updateIndex = 0,
+ fsz = CAST_U32(updateFiles.size());
+ updateIndex < fsz;
+ updateIndex++)
{
const UpdateFile &file = updateFiles[updateIndex];
if (!file.group.empty())
@@ -752,8 +758,10 @@ void UpdaterWindow::unloadManaPlusUpdates(const std::string &dir)
const std::vector<UpdateFile> updateFiles = loadXMLFile(
std::string(fixPath).append("/").append(xmlUpdateFile), true);
- for (unsigned int updateIndex = 0, sz = CAST_U32(
- updateFiles.size()); updateIndex < sz; updateIndex ++)
+ for (unsigned int updateIndex = 0,
+ fsz = CAST_U32(updateFiles.size());
+ updateIndex < fsz;
+ updateIndex++)
{
std::string name = updateFiles[updateIndex].name;
if (strStartWith(name, "manaplus_"))
@@ -1056,7 +1064,7 @@ unsigned long UpdaterWindow::getFileHash(const std::string &filePath)
}
void UpdaterWindow::handleLink(const std::string &link,
- MouseEvent *event A_UNUSED)
+ MouseEvent *const event A_UNUSED)
{
if (strStartWith(link, "http://") || strStartWith(link, "https://"))
openBrowser(link);
@@ -1085,8 +1093,10 @@ void UpdaterWindow::loadMods(const std::string &dir,
splitToStringSet(modsList, modsString, '|');
const std::string fixPath = dir + "/fix";
- for (unsigned int updateIndex = 0, sz = CAST_U32(
- updateFiles.size()); updateIndex < sz; updateIndex ++)
+ for (unsigned int updateIndex = 0,
+ fsz = CAST_U32(updateFiles.size());
+ updateIndex < fsz;
+ updateIndex ++)
{
const UpdateFile &file = updateFiles[updateIndex];
if (file.group.empty())
@@ -1105,8 +1115,10 @@ void UpdaterWindow::loadMods(const std::string &dir,
std::vector<UpdateFile> updateFiles2 = loadXMLFile(
std::string(fixPath).append("/").append(xmlUpdateFile), true);
- for (unsigned int updateIndex = 0, sz = CAST_U32(
- updateFiles2.size()); updateIndex < sz; updateIndex ++)
+ for (unsigned int updateIndex = 0,
+ fsz = CAST_U32(updateFiles2.size());
+ updateIndex < fsz;
+ updateIndex++)
{
const UpdateFile &file = updateFiles2[updateIndex];
if (file.group.empty())
diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h
index 2af2bb665..3bd8a5a6f 100644
--- a/src/gui/windows/updaterwindow.h
+++ b/src/gui/windows/updaterwindow.h
@@ -113,7 +113,7 @@ class UpdaterWindow final : public Window,
void logic() override final;
void handleLink(const std::string &link,
- MouseEvent *event A_UNUSED) override final;
+ MouseEvent *const event A_UNUSED) override final;
void loadFile(std::string file);
@@ -157,9 +157,9 @@ class UpdaterWindow final : public Window,
* A download callback for progress updates.
*/
static int updateProgress(void *ptr,
- DownloadStatusT status,
+ const DownloadStatusT status,
size_t dt,
- size_t dn);
+ const size_t dn);
/**
* A libcurl callback for writing to memory.