summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-29 19:05:52 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-29 20:53:56 +0300
commit864e023e0faeca5aa662023a54af7e4f9797fafa (patch)
treeae76f85900e16e2c15d82b661077a265ecdd2276 /src
parent4c4d59b85e3b89812cede60dea8cf0d0185695ae (diff)
downloadmv-864e023e0faeca5aa662023a54af7e4f9797fafa.tar.gz
mv-864e023e0faeca5aa662023a54af7e4f9797fafa.tar.bz2
mv-864e023e0faeca5aa662023a54af7e4f9797fafa.tar.xz
mv-864e023e0faeca5aa662023a54af7e4f9797fafa.zip
Move foreach macroses into separate file.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/actormanager.cpp1
-rw-r--r--src/being/actorsprite.cpp1
-rw-r--r--src/being/being.cpp1
-rw-r--r--src/being/compoundsprite.cpp1
-rw-r--r--src/being/localplayer.cpp1
-rw-r--r--src/being/playerrelations.cpp1
-rw-r--r--src/configuration.cpp1
-rw-r--r--src/fs/paths.cpp2
-rw-r--r--src/fs/virtfs/fs.cpp1
-rw-r--r--src/fs/virtfs/fsdir.cpp1
-rw-r--r--src/fs/virtfs/fszip.cpp1
-rw-r--r--src/fs/virtfs/tools.cpp1
-rw-r--r--src/fs/virtfs/virtfs1_unittest.cc1
-rw-r--r--src/fs/virtfs/virtfs_unittest.cc1
-rw-r--r--src/gui/focushandler.cpp2
-rw-r--r--src/gui/gui.cpp1
-rw-r--r--src/gui/models/extendedlistmodel.h2
-rw-r--r--src/gui/models/iconsmodel.h2
-rw-r--r--src/gui/models/itemsmodel.h2
-rw-r--r--src/gui/models/shopitems.cpp1
-rw-r--r--src/gui/models/skillmodel.cpp2
-rw-r--r--src/gui/models/touchactionmodel.cpp2
-rw-r--r--src/gui/models/updatelistmodel.h2
-rw-r--r--src/gui/palette.cpp1
-rw-r--r--src/gui/popups/beingpopup.cpp1
-rw-r--r--src/gui/popups/itempopup.cpp2
-rw-r--r--src/gui/theme.cpp1
-rw-r--r--src/gui/userpalette.cpp1
-rw-r--r--src/gui/viewport.cpp1
-rw-r--r--src/gui/widgets/basiccontainer.cpp2
-rw-r--r--src/gui/widgets/browserbox.cpp1
-rw-r--r--src/gui/widgets/characterviewnormal.cpp2
-rw-r--r--src/gui/widgets/characterviewsmall.cpp1
-rw-r--r--src/gui/widgets/emotepage.cpp1
-rw-r--r--src/gui/widgets/listbox.cpp2
-rw-r--r--src/gui/widgets/selldialog.cpp1
-rw-r--r--src/gui/widgets/staticbrowserbox.cpp1
-rw-r--r--src/gui/widgets/statspage.cpp2
-rw-r--r--src/gui/widgets/statspagebasic.cpp1
-rw-r--r--src/gui/widgets/tabbedarea.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_mods.cpp1
-rw-r--r--src/gui/widgets/tabs/socialfriendstab.h1
-rw-r--r--src/gui/widgets/tabs/socialguildtab.h1
-rw-r--r--src/gui/widgets/tabs/socialguildtab2.h1
-rw-r--r--src/gui/widgets/tabs/socialpartytab.h1
-rw-r--r--src/gui/widgets/tabstrip.cpp2
-rw-r--r--src/gui/widgets/vertcontainer.cpp2
-rw-r--r--src/gui/widgets/widget.cpp2
-rw-r--r--src/gui/widgets/windowcontainer.cpp1
-rw-r--r--src/gui/windowmenu.cpp1
-rw-r--r--src/gui/windows/buydialog.cpp1
-rw-r--r--src/gui/windows/buyselldialog.cpp1
-rw-r--r--src/gui/windows/charselectdialog.cpp2
-rw-r--r--src/gui/windows/chatwindow.cpp1
-rw-r--r--src/gui/windows/editdialog.cpp1
-rw-r--r--src/gui/windows/emotewindow.cpp1
-rw-r--r--src/gui/windows/equipmentwindow.cpp1
-rw-r--r--src/gui/windows/helpwindow.cpp1
-rw-r--r--src/gui/windows/minimap.cpp1
-rw-r--r--src/gui/windows/ministatuswindow.cpp1
-rw-r--r--src/gui/windows/questswindow.cpp1
-rw-r--r--src/gui/windows/serverdialog.cpp1
-rw-r--r--src/gui/windows/serverinfowindow.cpp1
-rw-r--r--src/gui/windows/setupwindow.cpp1
-rw-r--r--src/gui/windows/shopwindow.cpp1
-rw-r--r--src/gui/windows/shortcutwindow.cpp1
-rw-r--r--src/gui/windows/statuswindow.cpp1
-rw-r--r--src/gui/windows/updaterwindow.cpp1
-rw-r--r--src/gui/windows/whoisonline.cpp1
-rw-r--r--src/input/joystick.cpp1
-rw-r--r--src/input/keyboardconfig.cpp1
-rw-r--r--src/input/touch/touchmanager.cpp1
-rw-r--r--src/integrity_unittest.cc1
-rw-r--r--src/listeners/arrowslistener.cpp2
-rw-r--r--src/listeners/attributelistener.cpp2
-rw-r--r--src/listeners/banklistener.cpp2
-rw-r--r--src/listeners/buyingstoremodelistener.cpp2
-rw-r--r--src/listeners/buyingstoreslotslistener.cpp2
-rw-r--r--src/listeners/debugmessagelistener.cpp2
-rw-r--r--src/listeners/gamemodifierlistener.cpp2
-rw-r--r--src/listeners/playerdeathlistener.cpp2
-rw-r--r--src/listeners/statlistener.cpp2
-rw-r--r--src/listeners/updatestatuslistener.cpp2
-rw-r--r--src/listeners/vendingmodelistener.cpp2
-rw-r--r--src/listeners/vendingslotslistener.cpp2
-rw-r--r--src/localconsts.h12
-rw-r--r--src/logger.cpp1
-rw-r--r--src/net/ea/beingrecv.cpp2
-rw-r--r--src/net/ea/inventoryrecv.cpp1
-rw-r--r--src/net/eathena/beingrecv.cpp1
-rw-r--r--src/net/eathena/buyingstorehandler.cpp2
-rw-r--r--src/net/eathena/cashshophandler.cpp2
-rw-r--r--src/net/eathena/inventoryhandler.cpp2
-rw-r--r--src/net/eathena/inventoryrecv.cpp1
-rw-r--r--src/net/eathena/loginrecv.cpp1
-rw-r--r--src/net/eathena/markethandler.cpp2
-rw-r--r--src/net/eathena/network.cpp1
-rw-r--r--src/net/eathena/npchandler.cpp2
-rw-r--r--src/net/eathena/partyrecv.cpp1
-rw-r--r--src/net/eathena/vendinghandler.cpp2
-rw-r--r--src/net/ipc.cpp1
-rw-r--r--src/net/tmwa/partyrecv.cpp2
-rw-r--r--src/particle/particle.cpp1
-rw-r--r--src/particle/particleemitter.cpp2
-rw-r--r--src/particle/particlelist.cpp2
-rw-r--r--src/render/mobileopengl2graphics.cpp1
-rw-r--r--src/render/modernopenglgraphics.cpp1
-rw-r--r--src/resources/action.cpp1
-rw-r--r--src/resources/animation/animation.cpp2
-rw-r--r--src/resources/atlas/textureatlas.h1
-rw-r--r--src/resources/beingcommon.h2
-rw-r--r--src/resources/db/badgesdb.cpp1
-rw-r--r--src/resources/db/colordb.cpp1
-rw-r--r--src/resources/db/emotedb.cpp1
-rw-r--r--src/resources/db/horsedb.cpp1
-rw-r--r--src/resources/db/itemdb.cpp1
-rw-r--r--src/resources/db/itemoptiondb.cpp1
-rw-r--r--src/resources/db/mapdb.cpp2
-rw-r--r--src/resources/db/npcdialogdb.cpp1
-rw-r--r--src/resources/delayedmanager.cpp1
-rw-r--r--src/resources/dye/dyepalette.cpp1
-rw-r--r--src/resources/inventory/inventory.cpp1
-rw-r--r--src/resources/item/complexitem.cpp1
-rw-r--r--src/resources/map/map.cpp1
-rw-r--r--src/resources/map/maplayer.cpp2
-rw-r--r--src/resources/map/speciallayer.cpp1
-rw-r--r--src/resources/map/tileanimation.cpp1
-rw-r--r--src/resources/resourcemanager/resourcemanager.cpp1
-rw-r--r--src/resources/skill/skillinfo.cpp1
-rw-r--r--src/resources/sprite/spritedef.cpp1
-rw-r--r--src/resources/wallpaper.cpp2
-rw-r--r--src/spellmanager.cpp1
-rw-r--r--src/textmanager.cpp2
-rw-r--r--src/utils/chatutils.cpp1
-rw-r--r--src/utils/foreach.h36
-rw-r--r--src/utils/stringutils.cpp5
-rw-r--r--src/utils/translation/translationmanager.cpp2
139 files changed, 221 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6cd1c3a25..57eca194d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -869,6 +869,7 @@ SET(SRCS
utils/dumplibs.h
utils/env.cpp
utils/env.h
+ utils/foreach.h
fs/files.cpp
fs/files.h
utils/fuzzer.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index e02aa0972..8c52ba399 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -565,6 +565,7 @@ BASE_SRC += events/actionevent.h \
utils/dumplibs.h \
utils/env.cpp \
utils/env.h \
+ utils/foreach.h \
fs/files.cpp \
fs/files.h \
utils/fuzzer.cpp \
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index bef691a71..66fc5485d 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -45,6 +45,7 @@
#include "input/inputmanager.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "utils/mathutils.h"
#include "utils/gettext.h"
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 71970b7ff..626020ba0 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -45,6 +45,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/timer.h"
#include "debug.h"
diff --git a/src/being/being.cpp b/src/being/being.cpp
index e954a5e97..db70e2ab8 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -114,6 +114,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/timer.h"
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index f8738b44e..2bc1d555c 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -36,6 +36,7 @@
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/sdlcheckutils.h"
#ifndef USE_SDL2
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index ea64bb0a3..3ba0ffc70 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -88,6 +88,7 @@
#include "resources/sprite/animatedsprite.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/timer.h"
diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp
index 690665b15..8911ef3e7 100644
--- a/src/being/playerrelations.cpp
+++ b/src/being/playerrelations.cpp
@@ -31,6 +31,7 @@
#include "being/playerrelation.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "listeners/playerrelationslistener.h"
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 9e0fd1412..f0436707d 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -33,6 +33,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#ifdef DEBUG_CONFIG
#include "utils/stringmap.h"
#endif // DEBUG_CONFIG
diff --git a/src/fs/paths.cpp b/src/fs/paths.cpp
index 659fc49e4..46eae158e 100644
--- a/src/fs/paths.cpp
+++ b/src/fs/paths.cpp
@@ -35,6 +35,8 @@
#include "fs/files.h"
#endif // USE_X11
+#include "utils/foreach.h"
+
#ifdef __native_client__
#include <limits.h>
#define realpath(N, R) strcpy(R, N)
diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp
index b4847ad13..d9973d79b 100644
--- a/src/fs/virtfs/fs.cpp
+++ b/src/fs/virtfs/fs.cpp
@@ -33,6 +33,7 @@
#include "fs/virtfs/zipreader.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/fs/virtfs/fsdir.cpp b/src/fs/virtfs/fsdir.cpp
index 08879da5d..d4e9ce900 100644
--- a/src/fs/virtfs/fsdir.cpp
+++ b/src/fs/virtfs/fsdir.cpp
@@ -31,6 +31,7 @@
#include "fs/virtfs/list.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include <dirent.h>
diff --git a/src/fs/virtfs/fszip.cpp b/src/fs/virtfs/fszip.cpp
index 43891c783..d3821b5b9 100644
--- a/src/fs/virtfs/fszip.cpp
+++ b/src/fs/virtfs/fszip.cpp
@@ -29,6 +29,7 @@
#include "fs/virtfs/ziplocalheader.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/fs/virtfs/tools.cpp b/src/fs/virtfs/tools.cpp
index 7e572ecc3..64153fc52 100644
--- a/src/fs/virtfs/tools.cpp
+++ b/src/fs/virtfs/tools.cpp
@@ -27,6 +27,7 @@
#include "fs/virtfs/fs.h"
#include "fs/virtfs/list.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include <algorithm>
diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc
index d098d5765..69d40b9b3 100644
--- a/src/fs/virtfs/virtfs1_unittest.cc
+++ b/src/fs/virtfs/virtfs1_unittest.cc
@@ -29,6 +29,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
PRAGMA48(GCC diagnostic push)
diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc
index 3305c0264..f31157f35 100644
--- a/src/fs/virtfs/virtfs_unittest.cc
+++ b/src/fs/virtfs/virtfs_unittest.cc
@@ -28,6 +28,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#ifndef UNITTESTS_CATCH
#include <algorithm>
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index 21b80d9bf..ebfc988ac 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -71,6 +71,8 @@
#include "listeners/focuslistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
FocusHandler::FocusHandler() :
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 8063207c6..d1424b445 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -98,6 +98,7 @@
#include "resources/resourcemanager/resourcemanager.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/langs.h"
#include "utils/sdlsharedhelper.h"
#include "utils/timer.h"
diff --git a/src/gui/models/extendedlistmodel.h b/src/gui/models/extendedlistmodel.h
index 981a96897..307b4af80 100644
--- a/src/gui/models/extendedlistmodel.h
+++ b/src/gui/models/extendedlistmodel.h
@@ -23,6 +23,8 @@
#include "gui/models/listmodel.h"
+#include "utils/foreach.h"
+
#include "resources/image/image.h"
class ExtendedListModel notfinal : public ListModel
diff --git a/src/gui/models/iconsmodel.h b/src/gui/models/iconsmodel.h
index 1e4709554..4028895fb 100644
--- a/src/gui/models/iconsmodel.h
+++ b/src/gui/models/iconsmodel.h
@@ -25,6 +25,8 @@
#include "gui/models/listmodel.h"
+#include "utils/foreach.h"
+
#include "resources/iteminfo.h"
#include "resources/db/itemdb.h"
diff --git a/src/gui/models/itemsmodel.h b/src/gui/models/itemsmodel.h
index 8be90ab12..a49a7cfc5 100644
--- a/src/gui/models/itemsmodel.h
+++ b/src/gui/models/itemsmodel.h
@@ -29,6 +29,8 @@
#include "resources/db/itemdb.h"
+#include "utils/foreach.h"
+
#include <list>
#include "localconsts.h"
diff --git a/src/gui/models/shopitems.cpp b/src/gui/models/shopitems.cpp
index a5c05388b..763b75390 100644
--- a/src/gui/models/shopitems.cpp
+++ b/src/gui/models/shopitems.cpp
@@ -25,6 +25,7 @@
#include "resources/item/shopitem.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/gui/models/skillmodel.cpp b/src/gui/models/skillmodel.cpp
index 102956897..0dcf9cedd 100644
--- a/src/gui/models/skillmodel.cpp
+++ b/src/gui/models/skillmodel.cpp
@@ -22,6 +22,8 @@
#include "gui/models/skillmodel.h"
+#include "utils/foreach.h"
+
#include "resources/skill/skilldata.h"
#include "debug.h"
diff --git a/src/gui/models/touchactionmodel.cpp b/src/gui/models/touchactionmodel.cpp
index 983fc7065..7f6b68ef7 100644
--- a/src/gui/models/touchactionmodel.cpp
+++ b/src/gui/models/touchactionmodel.cpp
@@ -23,6 +23,8 @@
#include "gui/models/touchactionmodel.h"
+#include "utils/foreach.h"
+
#include <algorithm>
#include "debug.h"
diff --git a/src/gui/models/updatelistmodel.h b/src/gui/models/updatelistmodel.h
index 8156ec145..74bd44af1 100644
--- a/src/gui/models/updatelistmodel.h
+++ b/src/gui/models/updatelistmodel.h
@@ -27,6 +27,8 @@
#include "net/serverinfo.h"
+#include "utils/foreach.h"
+
#include "localconsts.h"
class UpdateListModel final : public ListModel
diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp
index 25f8084e9..c7bd7612e 100644
--- a/src/gui/palette.cpp
+++ b/src/gui/palette.cpp
@@ -23,6 +23,7 @@
#include "gui/palette.h"
+#include "utils/foreach.h"
#include "utils/timer.h"
#ifndef USE_SDL2
diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp
index 4cafcca27..015134c9f 100644
--- a/src/gui/popups/beingpopup.cpp
+++ b/src/gui/popups/beingpopup.cpp
@@ -36,6 +36,7 @@
#include "resources/chatobject.h"
#include "utils/gettext.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index 4b35b7118..5c5dfd19e 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -52,6 +52,8 @@
#include "net/beinghandler.h"
#include "net/net.h"
+#include "utils/foreach.h"
+
#include "utils/translation/podict.h"
#include "debug.h"
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 9150ad1a7..1ce1b7e30 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -48,6 +48,7 @@
#include "resources/loaders/xmlloader.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index ce48fea70..79e3758ac 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -25,6 +25,7 @@
#include "configuration.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index db236c5c8..1e9035cee 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -51,6 +51,7 @@
#include "input/inputmanager.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "resources/map/map.h"
#include "resources/map/mapitem.h"
diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp
index 771ba83f4..768733ae5 100644
--- a/src/gui/widgets/basiccontainer.cpp
+++ b/src/gui/widgets/basiccontainer.cpp
@@ -63,6 +63,8 @@
#include "gui/widgets/basiccontainer.h"
+#include "utils/foreach.h"
+
#include "render/graphics.h"
#include <algorithm>
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 08db7e3bf..7687737b5 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -45,6 +45,7 @@
#include "utils/browserboxtools.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "utils/timer.h"
#include "utils/translation/podict.h"
diff --git a/src/gui/widgets/characterviewnormal.cpp b/src/gui/widgets/characterviewnormal.cpp
index c92ad7477..288428d60 100644
--- a/src/gui/widgets/characterviewnormal.cpp
+++ b/src/gui/widgets/characterviewnormal.cpp
@@ -24,6 +24,8 @@
#include "gui/widgets/characterdisplay.h"
+#include "utils/foreach.h"
+
#include "debug.h"
CharacterViewNormal::CharacterViewNormal(CharSelectDialog *const widget,
diff --git a/src/gui/widgets/characterviewsmall.cpp b/src/gui/widgets/characterviewsmall.cpp
index a861e5033..81580f9e1 100644
--- a/src/gui/widgets/characterviewsmall.cpp
+++ b/src/gui/widgets/characterviewsmall.cpp
@@ -24,6 +24,7 @@
#include "gui/widgets/characterdisplay.h"
#include "gui/widgets/label.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp
index 88f4addd4..afd165219 100644
--- a/src/gui/widgets/emotepage.cpp
+++ b/src/gui/widgets/emotepage.cpp
@@ -29,6 +29,7 @@
#include "resources/loaders/imagesetloader.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 9628c2764..0bf590f6b 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -77,6 +77,8 @@
#include "listeners/selectionlistener.h"
+#include "utils/foreach.h"
+
#include "render/graphics.h"
#include "debug.h"
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp
index 2d613fae8..68b9a039f 100644
--- a/src/gui/widgets/selldialog.cpp
+++ b/src/gui/widgets/selldialog.cpp
@@ -40,6 +40,7 @@
#include "gui/widgets/slider.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
diff --git a/src/gui/widgets/staticbrowserbox.cpp b/src/gui/widgets/staticbrowserbox.cpp
index ed9e1e17d..ef51660c0 100644
--- a/src/gui/widgets/staticbrowserbox.cpp
+++ b/src/gui/widgets/staticbrowserbox.cpp
@@ -45,6 +45,7 @@
#include "utils/browserboxtools.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "utils/translation/podict.h"
diff --git a/src/gui/widgets/statspage.cpp b/src/gui/widgets/statspage.cpp
index eca98b1c4..65d322c05 100644
--- a/src/gui/widgets/statspage.cpp
+++ b/src/gui/widgets/statspage.cpp
@@ -25,6 +25,8 @@
#include "gui/widgets/attrs/derdisplay.h"
+#include "utils/foreach.h"
+
#include "resources/db/statdb.h"
#include "debug.h"
diff --git a/src/gui/widgets/statspagebasic.cpp b/src/gui/widgets/statspagebasic.cpp
index bdf90e14f..2996e5f12 100644
--- a/src/gui/widgets/statspagebasic.cpp
+++ b/src/gui/widgets/statspagebasic.cpp
@@ -28,6 +28,7 @@
#include "gui/widgets/attrs/changedisplay.h"
#include "utils/gettext.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "resources/db/statdb.h"
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 95ea305d6..f63772907 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -72,6 +72,7 @@
#include "gui/widgets/tabs/tab.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/gui/widgets/tabs/setup_mods.cpp b/src/gui/widgets/tabs/setup_mods.cpp
index 7ee8f2f34..c3ca23245 100644
--- a/src/gui/widgets/tabs/setup_mods.cpp
+++ b/src/gui/widgets/tabs/setup_mods.cpp
@@ -31,6 +31,7 @@
#include "resources/db/moddb.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/widgets/tabs/socialfriendstab.h b/src/gui/widgets/tabs/socialfriendstab.h
index 5bd13220b..017f465c7 100644
--- a/src/gui/widgets/tabs/socialfriendstab.h
+++ b/src/gui/widgets/tabs/socialfriendstab.h
@@ -34,6 +34,7 @@
#include "gui/widgets/tabs/socialfriendsfunctor.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "localconsts.h"
diff --git a/src/gui/widgets/tabs/socialguildtab.h b/src/gui/widgets/tabs/socialguildtab.h
index 775e22c6f..8652a54fe 100644
--- a/src/gui/widgets/tabs/socialguildtab.h
+++ b/src/gui/widgets/tabs/socialguildtab.h
@@ -27,6 +27,7 @@
#include "being/localplayer.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
diff --git a/src/gui/widgets/tabs/socialguildtab2.h b/src/gui/widgets/tabs/socialguildtab2.h
index f26e99421..ff8544232 100644
--- a/src/gui/widgets/tabs/socialguildtab2.h
+++ b/src/gui/widgets/tabs/socialguildtab2.h
@@ -29,6 +29,7 @@
#include "being/localplayer.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
diff --git a/src/gui/widgets/tabs/socialpartytab.h b/src/gui/widgets/tabs/socialpartytab.h
index b24f8f411..d7f22c1f7 100644
--- a/src/gui/widgets/tabs/socialpartytab.h
+++ b/src/gui/widgets/tabs/socialpartytab.h
@@ -31,6 +31,7 @@
#include "net/partyhandler.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp
index 2a8299ea1..6b3dbe417 100644
--- a/src/gui/widgets/tabstrip.cpp
+++ b/src/gui/widgets/tabstrip.cpp
@@ -22,6 +22,8 @@
#include "gui/widgets/button.h"
+#include "utils/foreach.h"
+
#include "debug.h"
TabStrip::TabStrip(const Widget2 *const widget,
diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp
index e15dc2481..714daae23 100644
--- a/src/gui/widgets/vertcontainer.cpp
+++ b/src/gui/widgets/vertcontainer.cpp
@@ -21,6 +21,8 @@
#include "gui/widgets/vertcontainer.h"
+#include "utils/foreach.h"
+
#include "debug.h"
VertContainer::VertContainer(const Widget2 *const widget,
diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp
index 260272936..8b49fddfd 100644
--- a/src/gui/widgets/widget.cpp
+++ b/src/gui/widgets/widget.cpp
@@ -73,6 +73,8 @@
#include "listeners/widgetdeathlistener.h"
#include "listeners/widgetlistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
Font* Widget::mGlobalFont = nullptr;
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index 38efd1a77..e054e27ad 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -25,6 +25,7 @@
#include "gui/widgets/window.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 41640a458..73a40531a 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -39,6 +39,7 @@
#include "gui/widgets/button.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index edac6293d..b2249f66c 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -59,6 +59,7 @@
#include "resources/db/unitsdb.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include <algorithm>
diff --git a/src/gui/windows/buyselldialog.cpp b/src/gui/windows/buyselldialog.cpp
index 009a24839..26cf2af17 100644
--- a/src/gui/windows/buyselldialog.cpp
+++ b/src/gui/windows/buyselldialog.cpp
@@ -31,6 +31,7 @@
#include "gui/widgets/button.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index cd801f61d..00fafdf1f 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -48,6 +48,8 @@
#include "net/net.h"
#include "net/serverfeatures.h"
+#include "utils/foreach.h"
+
#include "resources/db/unitsdb.h"
#include "debug.h"
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 80c24af0a..eea0905cf 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -75,6 +75,7 @@
#include "utils/copynpaste.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/translation/podict.h"
diff --git a/src/gui/windows/editdialog.cpp b/src/gui/windows/editdialog.cpp
index be62c13b5..e14b96191 100644
--- a/src/gui/windows/editdialog.cpp
+++ b/src/gui/windows/editdialog.cpp
@@ -24,6 +24,7 @@
#include "gui/widgets/button.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp
index 0125177b1..981fb0b11 100644
--- a/src/gui/windows/emotewindow.cpp
+++ b/src/gui/windows/emotewindow.cpp
@@ -32,6 +32,7 @@
#include "gui/widgets/tabbedarea.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/translation/podict.h"
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index d77302035..1a95f4eee 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -48,6 +48,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "net/inventoryhandler.h"
diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp
index ce121a98f..cd6e37941 100644
--- a/src/gui/windows/helpwindow.cpp
+++ b/src/gui/windows/helpwindow.cpp
@@ -41,6 +41,7 @@
#include "input/inputmanager.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/process.h"
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 869fede55..95d606618 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -52,6 +52,7 @@
#include "resources/loaders/imageloader.h"
#include "utils/gettext.h"
+#include "utils/foreach.h"
#include "utils/sdlcheckutils.h"
#include "debug.h"
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index b3e63c226..312dd488a 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -47,6 +47,7 @@
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp
index 615c23d64..af9f19369 100644
--- a/src/gui/windows/questswindow.cpp
+++ b/src/gui/windows/questswindow.cpp
@@ -46,6 +46,7 @@
#include "gui/widgets/staticbrowserbox.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "resources/questeffect.h"
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index ee5300d7d..6093b67b4 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -46,6 +46,7 @@
#include "gui/widgets/scrollarea.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/langs.h"
#include "debug.h"
diff --git a/src/gui/windows/serverinfowindow.cpp b/src/gui/windows/serverinfowindow.cpp
index dcede8063..d1eb8cb44 100644
--- a/src/gui/windows/serverinfowindow.cpp
+++ b/src/gui/windows/serverinfowindow.cpp
@@ -28,6 +28,7 @@
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/staticbrowserbox.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/process.h"
diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp
index bf5272d24..40354f62a 100644
--- a/src/gui/windows/setupwindow.cpp
+++ b/src/gui/windows/setupwindow.cpp
@@ -55,6 +55,7 @@
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 54656a66b..9ff15b024 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -77,6 +77,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#ifdef TMWA_SUPPORT
diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp
index ffac3d320..61a7e6b45 100644
--- a/src/gui/windows/shortcutwindow.cpp
+++ b/src/gui/windows/shortcutwindow.cpp
@@ -36,6 +36,7 @@
#include "gui/widgets/tabs/shortcuttab.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 3ec369b93..9fe112f78 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -55,6 +55,7 @@
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 86045c62d..db7d48c36 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -50,6 +50,7 @@
#include "resources/db/moddb.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include <sys/stat.h>
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index 697e3a0d5..3f253abc2 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -55,6 +55,7 @@
#include "net/playerhandler.h"
#include "net/serverfeatures.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/sdlhelper.h"
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp
index 4ad887461..5e0392c8e 100644
--- a/src/input/joystick.cpp
+++ b/src/input/joystick.cpp
@@ -29,6 +29,7 @@
#include "input/inputmanager.h"
+#include "utils/foreach.h"
#include "utils/timer.h"
PRAGMA48(GCC diagnostic push)
diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp
index 794d4d377..1ce317db7 100644
--- a/src/input/keyboardconfig.cpp
+++ b/src/input/keyboardconfig.cpp
@@ -26,6 +26,7 @@
#include "input/inputmanager.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/input/touch/touchmanager.cpp b/src/input/touch/touchmanager.cpp
index e9c378ef7..df98e667f 100644
--- a/src/input/touch/touchmanager.cpp
+++ b/src/input/touch/touchmanager.cpp
@@ -34,6 +34,7 @@
#include "input/touch/touchactions.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "render/graphics.h"
diff --git a/src/integrity_unittest.cc b/src/integrity_unittest.cc
index a4cbc7c48..130716ce6 100644
--- a/src/integrity_unittest.cc
+++ b/src/integrity_unittest.cc
@@ -48,6 +48,7 @@
#include "utils/env.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
PRAGMA48(GCC diagnostic push)
PRAGMA48(GCC diagnostic ignored "-Wshadow")
diff --git a/src/listeners/arrowslistener.cpp b/src/listeners/arrowslistener.cpp
index 4a9074b74..9ae92b93d 100644
--- a/src/listeners/arrowslistener.cpp
+++ b/src/listeners/arrowslistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/arrowslistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(ArrowsListener)
diff --git a/src/listeners/attributelistener.cpp b/src/listeners/attributelistener.cpp
index dd6fc145c..0e12052e9 100644
--- a/src/listeners/attributelistener.cpp
+++ b/src/listeners/attributelistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/attributelistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(AttributeListener)
diff --git a/src/listeners/banklistener.cpp b/src/listeners/banklistener.cpp
index c308ece27..e3cac0067 100644
--- a/src/listeners/banklistener.cpp
+++ b/src/listeners/banklistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/banklistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(BankListener)
diff --git a/src/listeners/buyingstoremodelistener.cpp b/src/listeners/buyingstoremodelistener.cpp
index 8c17188f5..b6723f5c5 100644
--- a/src/listeners/buyingstoremodelistener.cpp
+++ b/src/listeners/buyingstoremodelistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/buyingstoremodelistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(BuyingStoreModeListener)
diff --git a/src/listeners/buyingstoreslotslistener.cpp b/src/listeners/buyingstoreslotslistener.cpp
index e62ee1d4a..fc7c307a4 100644
--- a/src/listeners/buyingstoreslotslistener.cpp
+++ b/src/listeners/buyingstoreslotslistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/buyingstoreslotslistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(BuyingStoreSlotsListener)
diff --git a/src/listeners/debugmessagelistener.cpp b/src/listeners/debugmessagelistener.cpp
index 92e1709b8..362c58a67 100644
--- a/src/listeners/debugmessagelistener.cpp
+++ b/src/listeners/debugmessagelistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/debugmessagelistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(DebugMessageListener)
diff --git a/src/listeners/gamemodifierlistener.cpp b/src/listeners/gamemodifierlistener.cpp
index 82f7ad5bb..c914c2da3 100644
--- a/src/listeners/gamemodifierlistener.cpp
+++ b/src/listeners/gamemodifierlistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/gamemodifierlistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(GameModifierListener)
diff --git a/src/listeners/playerdeathlistener.cpp b/src/listeners/playerdeathlistener.cpp
index 2b0b86c77..edd53e009 100644
--- a/src/listeners/playerdeathlistener.cpp
+++ b/src/listeners/playerdeathlistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/playerdeathlistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(PlayerDeathListener)
diff --git a/src/listeners/statlistener.cpp b/src/listeners/statlistener.cpp
index 577ba0cc8..8aff6b6a8 100644
--- a/src/listeners/statlistener.cpp
+++ b/src/listeners/statlistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/statlistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(StatListener)
diff --git a/src/listeners/updatestatuslistener.cpp b/src/listeners/updatestatuslistener.cpp
index e1a819e23..fbc044cf5 100644
--- a/src/listeners/updatestatuslistener.cpp
+++ b/src/listeners/updatestatuslistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/updatestatuslistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(UpdateStatusListener)
diff --git a/src/listeners/vendingmodelistener.cpp b/src/listeners/vendingmodelistener.cpp
index b0bd687f8..4e9b4d3d0 100644
--- a/src/listeners/vendingmodelistener.cpp
+++ b/src/listeners/vendingmodelistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/vendingmodelistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(VendingModeListener)
diff --git a/src/listeners/vendingslotslistener.cpp b/src/listeners/vendingslotslistener.cpp
index c89c865b4..1618480ee 100644
--- a/src/listeners/vendingslotslistener.cpp
+++ b/src/listeners/vendingslotslistener.cpp
@@ -20,6 +20,8 @@
#include "listeners/vendingslotslistener.h"
+#include "utils/foreach.h"
+
#include "debug.h"
defineListener(VendingSlotsListener)
diff --git a/src/localconsts.h b/src/localconsts.h
index bbc5f632d..e6b455cf6 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -301,18 +301,6 @@
#define notfinal
-#define FOR_EACH(type, iter, array) for (type iter = array.begin(), \
- iter##_fend = array.end(); iter != iter##_fend; ++ iter)
-
-#define FOR_EACHR(type, iter, array) for (type iter = array.rbegin(), \
- iter##_fend = array.rend(); iter != iter##_fend; ++ iter)
-
-#define FOR_EACHP(type, iter, array) for (type iter = array->begin(), \
- iter##_fend = array->end(); iter != iter##_fend; ++ iter)
-
-#define FOR_EACH_SAFE(type, iter, array) for (type iter = array.begin(); \
- iter != array.end(); ++ iter)
-
#ifdef ENABLE_CHECKPLUGIN
#define A_NONNULLPOINTER __attribute__((nonnullpointer))
#else // ENABLE_CHECKPLUGIN
diff --git a/src/logger.cpp b/src/logger.cpp
index 9e8e1be3e..69b37fc51 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -26,6 +26,7 @@
#include "listeners/debugmessagelistener.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include <iostream>
diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp
index b6e848bc5..fcb3871f8 100644
--- a/src/net/ea/beingrecv.cpp
+++ b/src/net/ea/beingrecv.cpp
@@ -40,6 +40,8 @@
#include "gui/windows/socialwindow.h"
+#include "utils/foreach.h"
+
#include "resources/map/map.h"
#include "net/messagein.h"
diff --git a/src/net/ea/inventoryrecv.cpp b/src/net/ea/inventoryrecv.cpp
index 0ccde29d4..3e8c239e9 100644
--- a/src/net/ea/inventoryrecv.cpp
+++ b/src/net/ea/inventoryrecv.cpp
@@ -38,6 +38,7 @@
#include "net/ea/equipbackend.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "listeners/arrowslistener.h"
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index d906ce835..d99fa241e 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -62,6 +62,7 @@
#include "resources/map/map.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "utils/timer.h"
#include "debug.h"
diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp
index 32ec084c9..d342be0b8 100644
--- a/src/net/eathena/buyingstorehandler.cpp
+++ b/src/net/eathena/buyingstorehandler.cpp
@@ -28,6 +28,8 @@
#include "net/eathena/messageout.h"
#include "net/eathena/protocolout.h"
+#include "utils/foreach.h"
+
#include "resources/item/shopitem.h"
#include "debug.h"
diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp
index 40af5324e..105a45141 100644
--- a/src/net/eathena/cashshophandler.cpp
+++ b/src/net/eathena/cashshophandler.cpp
@@ -24,6 +24,8 @@
#include "net/eathena/messageout.h"
#include "net/eathena/protocolout.h"
+#include "utils/foreach.h"
+
#include "resources/item/shopitem.h"
#include "debug.h"
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 7044b1611..74b0777e0 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -31,6 +31,8 @@
#include "net/eathena/messageout.h"
#include "net/eathena/protocolout.h"
+#include "utils/foreach.h"
+
#include "resources/item/item.h"
#include "debug.h"
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 7b6368dad..0b411d4ba 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -55,6 +55,7 @@
#include "resources/iteminfo.h"
#include "utils/gettext.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/net/eathena/loginrecv.cpp b/src/net/eathena/loginrecv.cpp
index 13818c9cf..38ee44e28 100644
--- a/src/net/eathena/loginrecv.cpp
+++ b/src/net/eathena/loginrecv.cpp
@@ -40,6 +40,7 @@
#include "net/eathena/updateprotocol.h"
#include "utils/gettext.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/net/eathena/markethandler.cpp b/src/net/eathena/markethandler.cpp
index a9a884ad3..bcba57e81 100644
--- a/src/net/eathena/markethandler.cpp
+++ b/src/net/eathena/markethandler.cpp
@@ -24,6 +24,8 @@
#include "net/eathena/messageout.h"
#include "net/eathena/protocolout.h"
+#include "utils/foreach.h"
+
#include "resources/item/shopitem.h"
#include "debug.h"
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 8b3504e4e..4c6194fdd 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -80,6 +80,7 @@
#include "resources/db/networkdb.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp
index 38a54a6fd..4e8d179f0 100644
--- a/src/net/eathena/npchandler.cpp
+++ b/src/net/eathena/npchandler.cpp
@@ -39,6 +39,8 @@
#include "net/eathena/protocolout.h"
+#include "utils/foreach.h"
+
#include "resources/item/shopitem.h"
#include "debug.h"
diff --git a/src/net/eathena/partyrecv.cpp b/src/net/eathena/partyrecv.cpp
index e820a0eac..2f6482ac1 100644
--- a/src/net/eathena/partyrecv.cpp
+++ b/src/net/eathena/partyrecv.cpp
@@ -38,6 +38,7 @@
#include "net/ea/partyrecv.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/net/eathena/vendinghandler.cpp b/src/net/eathena/vendinghandler.cpp
index b95b162b4..728e8fb7e 100644
--- a/src/net/eathena/vendinghandler.cpp
+++ b/src/net/eathena/vendinghandler.cpp
@@ -29,6 +29,8 @@
#include "net/eathena/protocolout.h"
#include "net/eathena/vendingrecv.h"
+#include "utils/foreach.h"
+
#include "resources/item/shopitem.h"
#include "debug.h"
diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp
index 19eace240..d7ffa1ae9 100644
--- a/src/net/ipc.cpp
+++ b/src/net/ipc.cpp
@@ -27,6 +27,7 @@
#endif // DYECMD
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/sdlhelper.h"
#include "utils/stringutils.h"
diff --git a/src/net/tmwa/partyrecv.cpp b/src/net/tmwa/partyrecv.cpp
index 78c012652..819b891d3 100644
--- a/src/net/tmwa/partyrecv.cpp
+++ b/src/net/tmwa/partyrecv.cpp
@@ -38,6 +38,8 @@
#include "net/ea/partyrecv.h"
+#include "utils/foreach.h"
+
#include "debug.h"
namespace TmwAthena
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index 89ac1aa7d..92c8a63fe 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -42,6 +42,7 @@
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/mathutils.h"
#include "utils/mrand.h"
diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp
index c200d787d..b13b03ca0 100644
--- a/src/particle/particleemitter.cpp
+++ b/src/particle/particleemitter.cpp
@@ -29,6 +29,8 @@
#include "particle/animationparticle.h"
#include "particle/rotationalparticle.h"
+#include "utils/foreach.h"
+
#include "resources/imageset.h"
#include "resources/dye/dye.h"
diff --git a/src/particle/particlelist.cpp b/src/particle/particlelist.cpp
index d854a1da2..26194453b 100644
--- a/src/particle/particlelist.cpp
+++ b/src/particle/particlelist.cpp
@@ -22,6 +22,8 @@
#include "particle/particlelist.h"
+#include "utils/foreach.h"
+
#include "particle/particle.h"
#include "debug.h"
diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp
index 620bc923a..1b532e48d 100644
--- a/src/render/mobileopengl2graphics.cpp
+++ b/src/render/mobileopengl2graphics.cpp
@@ -41,6 +41,7 @@
#include "resources/image/image.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/sdlcheckutils.h"
#include "debug.h"
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index 89ca10fd4..f034cdc65 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -42,6 +42,7 @@
#include "resources/image/image.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/sdlcheckutils.h"
#include "utils/sdlhelper.h"
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index c059624c5..9b3dab3f4 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -25,6 +25,7 @@
#include "resources/animation/animation.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/resources/animation/animation.cpp b/src/resources/animation/animation.cpp
index 4f83161de..3b066da15 100644
--- a/src/resources/animation/animation.cpp
+++ b/src/resources/animation/animation.cpp
@@ -22,6 +22,8 @@
#include "resources/animation/animation.h"
+#include "utils/foreach.h"
+
#include "debug.h"
Animation::Animation() noexcept2 :
diff --git a/src/resources/atlas/textureatlas.h b/src/resources/atlas/textureatlas.h
index f02eb6f35..a1fe4d145 100644
--- a/src/resources/atlas/textureatlas.h
+++ b/src/resources/atlas/textureatlas.h
@@ -23,6 +23,7 @@
#ifdef USE_OPENGL
+#include "utils/foreach.h"
#include "utils/stringvector.h"
#include "resources/atlas/atlasitem.h"
diff --git a/src/resources/beingcommon.h b/src/resources/beingcommon.h
index 4299d7707..c79e8a76c 100644
--- a/src/resources/beingcommon.h
+++ b/src/resources/beingcommon.h
@@ -23,10 +23,12 @@
#include "fs/virtfs/tools.h"
+#include "utils/foreach.h"
#include "utils/xml.h"
#include "localconsts.h"
+UTILS_FOREACH_H
UTILS_VIRTFSTOOLS_H
class BeingInfo;
diff --git a/src/resources/db/badgesdb.cpp b/src/resources/db/badgesdb.cpp
index 48034e3a3..873149f41 100644
--- a/src/resources/db/badgesdb.cpp
+++ b/src/resources/db/badgesdb.cpp
@@ -24,6 +24,7 @@
#include "fs/virtfs/tools.h"
+#include "utils/foreach.h"
#include "utils/xmlutils.h"
#include "debug.h"
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index f4cd0921b..92d06ce40 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -24,6 +24,7 @@
#include "configuration.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "resources/beingcommon.h"
diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp
index 72b7f0092..38da40f07 100644
--- a/src/resources/db/emotedb.cpp
+++ b/src/resources/db/emotedb.cpp
@@ -26,6 +26,7 @@
#include "configuration.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "resources/beingcommon.h"
#include "resources/emoteinfo.h"
diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp
index c9f363246..0339339ed 100644
--- a/src/resources/db/horsedb.cpp
+++ b/src/resources/db/horsedb.cpp
@@ -30,6 +30,7 @@
#include "utils/checkutils.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 542fa6789..440b69d16 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -44,6 +44,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/stringmap.h"
#include "utils/translation/podict.h"
diff --git a/src/resources/db/itemoptiondb.cpp b/src/resources/db/itemoptiondb.cpp
index bd78f95c5..80e149b6f 100644
--- a/src/resources/db/itemoptiondb.cpp
+++ b/src/resources/db/itemoptiondb.cpp
@@ -23,6 +23,7 @@
#include "configuration.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "resources/beingcommon.h"
diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp
index 7ae90815e..6b9a66f3b 100644
--- a/src/resources/db/mapdb.cpp
+++ b/src/resources/db/mapdb.cpp
@@ -24,6 +24,8 @@
#include "configuration.h"
#include "logger.h"
+#include "utils/foreach.h"
+
#include "resources/beingcommon.h"
#include "debug.h"
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index 0e4ab5ffc..bdf2c7841 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -27,6 +27,7 @@
#include "utils/checkutils.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/resources/delayedmanager.cpp b/src/resources/delayedmanager.cpp
index 73d31e1e8..1296095bb 100644
--- a/src/resources/delayedmanager.cpp
+++ b/src/resources/delayedmanager.cpp
@@ -22,6 +22,7 @@
#include "resources/sprite/animationdelayload.h"
+#include "utils/foreach.h"
#include "utils/timer.h"
#include "debug.h"
diff --git a/src/resources/dye/dyepalette.cpp b/src/resources/dye/dyepalette.cpp
index 255175ee1..0e0784d63 100644
--- a/src/resources/dye/dyepalette.cpp
+++ b/src/resources/dye/dyepalette.cpp
@@ -44,6 +44,7 @@ PRAGMA48(GCC diagnostic pop)
#ifdef SIMD_SUPPORTED
#include "utils/cpu.h"
#endif // SIMD_SUPPORTED
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/resources/inventory/inventory.cpp b/src/resources/inventory/inventory.cpp
index df7104d03..b7aa39e91 100644
--- a/src/resources/inventory/inventory.cpp
+++ b/src/resources/inventory/inventory.cpp
@@ -34,6 +34,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
diff --git a/src/resources/item/complexitem.cpp b/src/resources/item/complexitem.cpp
index 047c50614..b9de8dbe1 100644
--- a/src/resources/item/complexitem.cpp
+++ b/src/resources/item/complexitem.cpp
@@ -21,6 +21,7 @@
#include "resources/item/complexitem.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index f2c8f4636..8deea4b23 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -65,6 +65,7 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include "utils/timer.h"
#include <queue>
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index 2598b029c..f9f154a64 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -31,6 +31,8 @@
#include "gui/userpalette.h"
+#include "utils/foreach.h"
+
#include "render/graphics.h"
#include "resources/image/image.h"
diff --git a/src/resources/map/speciallayer.cpp b/src/resources/map/speciallayer.cpp
index 75b56be28..27713e074 100644
--- a/src/resources/map/speciallayer.cpp
+++ b/src/resources/map/speciallayer.cpp
@@ -27,6 +27,7 @@
#include "resources/map/mapitem.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/resources/map/tileanimation.cpp b/src/resources/map/tileanimation.cpp
index c8ce52a70..fee4ef150 100644
--- a/src/resources/map/tileanimation.cpp
+++ b/src/resources/map/tileanimation.cpp
@@ -27,6 +27,7 @@
#include "resources/map/maplayer.h"
#include "utils/delete2.h"
+#include "utils/foreach.h"
#include "debug.h"
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp
index d90448e7b..c599dd165 100644
--- a/src/resources/resourcemanager/resourcemanager.cpp
+++ b/src/resources/resourcemanager/resourcemanager.cpp
@@ -35,6 +35,7 @@
#include "resources/sprite/spritedef.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#if !defined(DEBUG_DUMP_LEAKS) && !defined(UNITTESTS)
#include "resources/resourcetypes.h"
diff --git a/src/resources/skill/skillinfo.cpp b/src/resources/skill/skillinfo.cpp
index 8c90fbd72..3c74fcaa9 100644
--- a/src/resources/skill/skillinfo.cpp
+++ b/src/resources/skill/skillinfo.cpp
@@ -26,6 +26,7 @@
#include "gui/models/skillmodel.h"
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "resources/skill/skilldata.h"
diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp
index 8824a2ac1..ccb8af30c 100644
--- a/src/resources/sprite/spritedef.cpp
+++ b/src/resources/sprite/spritedef.cpp
@@ -30,6 +30,7 @@
#include "const/resources/map/map.h"
#include "utils/checkutils.h"
+#include "utils/foreach.h"
#include "resources/action.h"
#include "resources/imageset.h"
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 09c1f3396..e474d2315 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -29,6 +29,8 @@
#include "resources/wallpaperdata.h"
+#include "utils/foreach.h"
+
#include <algorithm>
#ifdef WIN32
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index 4877e9e71..8dbdd0354 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -37,6 +37,7 @@
#include "resources/db/commandsdb.h"
#include "utils/dtor.h"
+#include "utils/foreach.h"
#include <sstream>
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index 9bd36d6fd..24d55b412 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -23,6 +23,8 @@
#include "text.h"
+#include "utils/foreach.h"
+
#include <cstring>
#include "debug.h"
diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp
index 53bb689a4..966e383bd 100644
--- a/src/utils/chatutils.cpp
+++ b/src/utils/chatutils.cpp
@@ -38,6 +38,7 @@
#include "net/tmwa/guildmanager.h"
#endif // TMWA_SUPPORT
+#include "utils/foreach.h"
#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/utils/foreach.h b/src/utils/foreach.h
new file mode 100644
index 000000000..d3212795f
--- /dev/null
+++ b/src/utils/foreach.h
@@ -0,0 +1,36 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2017 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef UTILS_FOREACH_H
+#define UTILS_FOREACH_H
+
+#define FOR_EACH(type, iter, array) for (type iter = array.begin(), \
+ iter##_fend = array.end(); iter != iter##_fend; ++ iter)
+
+#define FOR_EACHR(type, iter, array) for (type iter = array.rbegin(), \
+ iter##_fend = array.rend(); iter != iter##_fend; ++ iter)
+
+#define FOR_EACHP(type, iter, array) for (type iter = array->begin(), \
+ iter##_fend = array->end(); iter != iter##_fend; ++ iter)
+
+#define FOR_EACH_SAFE(type, iter, array) for (type iter = array.begin(); \
+ iter != array.end(); ++ iter)
+
+#endif // UTILS_FOREACH_H
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 1f0888629..201ffc0c4 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -30,6 +30,9 @@
#include "resources/db/itemdb.h"
#endif // DYECMD
+#include "utils/gettext.h"
+#include "utils/foreach.h"
+
#include <algorithm>
#include <sstream>
@@ -37,8 +40,6 @@
#include <sys/time.h>
#endif // WIN32
-#include "utils/gettext.h"
-
#include "debug.h"
std::string &trim(std::string &str)
diff --git a/src/utils/translation/translationmanager.cpp b/src/utils/translation/translationmanager.cpp
index aa0dd47da..72ca23c91 100644
--- a/src/utils/translation/translationmanager.cpp
+++ b/src/utils/translation/translationmanager.cpp
@@ -25,6 +25,8 @@
#include "utils/delete2.h"
#include "utils/stringutils.h"
+#include "utils/foreach.h"
+
#include "utils/translation/podict.h"
#include "utils/translation/poparser.h"