summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-09 09:47:21 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-13 12:57:16 +0100
commitc70be70cab3615cb36cc5f244671cf5d39f1fda8 (patch)
treeb15e68552ffd6adda832a9ae5d38160ef8299d7f /src/gui/widgets/itemcontainer.cpp
parent717eb07c0d51098e319059883b11ba6e2bf4cbb8 (diff)
downloadmana-c70be70cab3615cb36cc5f244671cf5d39f1fda8.tar.gz
mana-c70be70cab3615cb36cc5f244671cf5d39f1fda8.tar.bz2
mana-c70be70cab3615cb36cc5f244671cf5d39f1fda8.tar.xz
mana-c70be70cab3615cb36cc5f244671cf5d39f1fda8.zip
General code cleanups
* Removing unused includes * Use member initialization * Use range-based for loops * Use nullptr * Removed no longer used aliases * Use override * Don't use else after return * Use '= delete' to remove implicit members * Use std::string::empty instead of comparing to ""
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 5b373bb6..37a61c80 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -30,13 +30,8 @@
#include "gui/chatwindow.h"
#include "gui/itempopup.h"
#include "gui/outfitwindow.h"
-#include "gui/palette.h"
-#include "gui/sdlinput.h"
#include "gui/viewport.h"
-#include "net/net.h"
-#include "net/inventoryhandler.h"
-
#include "resources/image.h"
#include "resources/iteminfo.h"
#include "resources/theme.h"
@@ -53,15 +48,7 @@ static const int BOX_WIDTH = 35;
static const int BOX_HEIGHT = 43;
ItemContainer::ItemContainer(Inventory *inventory):
- mInventory(inventory),
- mGridColumns(1),
- mGridRows(1),
- mSelectedIndex(-1),
- mHighlightedIndex(-1),
- mLastUsedSlot(-1),
- mSelectionStatus(SEL_NONE),
- mSwapItems(false),
- mDescItems(false)
+ mInventory(inventory)
{
mItemPopup = new ItemPopup;
setFocusable(true);
@@ -112,7 +99,7 @@ void ItemContainer::draw(gcn::Graphics *graphics)
if (!item || item->getId() == 0)
continue;
- if (mFilter.size() > 0)
+ if (!mFilter.empty())
{
if (normalize(item->getInfo().getName()).find(mFilter) == std::string::npos)
continue;
@@ -220,13 +207,10 @@ void ItemContainer::setFilter(const std::string &filter)
void ItemContainer::distributeValueChangedEvent()
{
- SelectionListenerIterator i, i_end;
-
- for (i = mSelectionListeners.begin(), i_end = mSelectionListeners.end();
- i != i_end; ++i)
+ for (auto listener : mSelectionListeners)
{
gcn::SelectionEvent event(this);
- (*i)->valueChanged(event);
+ listener->valueChanged(event);
}
}