summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actormanager.cpp4
-rw-r--r--src/being/being.cpp2
-rw-r--r--src/being/localplayer.cpp6
-rw-r--r--src/being/localplayer.h1
-rw-r--r--src/client.cpp3
-rw-r--r--src/commands.cpp1
-rw-r--r--src/gui/popupmanager.cpp25
-rw-r--r--src/gui/popupmanager.h2
-rw-r--r--src/gui/popups/statuspopup.cpp6
-rw-r--r--src/gui/popups/statuspopup.h1
-rw-r--r--src/gui/viewport.cpp7
-rw-r--r--src/gui/viewport.h10
-rw-r--r--src/gui/widgets/guitable.h2
-rw-r--r--src/gui/widgets/textfield.cpp6
-rw-r--r--src/gui/widgets/textfield.h3
-rw-r--r--src/gui/windows/buydialog.cpp1
-rw-r--r--src/gui/windows/outfitwindow.cpp3
-rw-r--r--src/gui/windows/outfitwindow.h1
-rw-r--r--src/gui/windows/statuswindow.cpp3
-rw-r--r--src/net/ea/beinghandler.cpp1
-rw-r--r--src/net/ea/playerhandler.cpp1
-rw-r--r--src/net/ipc.cpp18
-rw-r--r--src/net/ipc.h6
-rw-r--r--src/resources/map/map.cpp1
24 files changed, 26 insertions, 88 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index ba9576aa7..56230bdf5 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1737,8 +1737,8 @@ Being *ActorManager::cloneBeing(const Being *const srcBeing,
srcBeing->getTileY() + dy);
dstBeing->setName(srcBeing->getName());
dstBeing->setDirection(srcBeing->getDirection());
- const size_t sz = srcBeing->getSpritesCount();
- for (size_t slot = 0; slot < sz; slot ++)
+ const int sz = static_cast<int>(srcBeing->getSpritesCount());
+ for (int slot = 0; slot < sz; slot ++)
{
const int spriteId = srcBeing->getSpriteID(slot);
const unsigned char color = srcBeing->getSpriteColor(slot);
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 471adedf9..4d45d19bd 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1445,7 +1445,7 @@ void Being::logic()
const int yOffset2 = yOffset - mSortOffsetY - mFixedOffsetY * mapTileSize / 2;
*/
const int halfTile = mapTileSize / 2;
- const float offset2 = mOffsetY * abs(offset) / 2;
+ const float offset2 = static_cast<float>(mOffsetY * abs(offset)) / 2;
mSortOffsetY = (mOldHeight - mFixedOffsetY + mOffsetY)
* halfTile - offset2;
const float yOffset3 = (mY + 1) * mapTileSize + yOffset
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index ba0467bfb..e81daf267 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -1223,8 +1223,12 @@ void LocalPlayer::moveToHome()
void LocalPlayer::changeEquipmentBeforeAttack(const Being *const target) const
{
- if (settings.attackWeaponType == 1 || !target || !PlayerInfo::getInventory())
+ if (settings.attackWeaponType == 1
+ || !target
+ || !PlayerInfo::getInventory())
+ {
return;
+ }
bool allowSword = false;
const int dx = target->getTileX() - mX;
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index d8a0d5e0f..341b9f8b0 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -443,7 +443,6 @@ class LocalPlayer final : public Being,
unsigned int mCrazyMoveState;
// move state. used if mMoveType == 2
unsigned int mMoveState;
- unsigned int mImitationMode;
int mLastTargetX;
int mLastTargetY;
diff --git a/src/client.cpp b/src/client.cpp
index 6f6c78f7c..0631b661c 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -94,9 +94,7 @@
#include "particle/particle.h"
#include "resources/imagehelper.h"
-#include "resources/openglimagehelper.h"
#include "resources/resourcemanager.h"
-#include "resources/surfaceimagehelper.h"
#include "resources/spritereference.h"
#include "resources/db/avatardb.h"
@@ -124,7 +122,6 @@
#endif
#include "utils/physfstools.h"
#include "utils/sdlcheckutils.h"
-#include "utils/sdlhelper.h"
#include "utils/timer.h"
#include "utils/translation/translationmanager.h"
diff --git a/src/commands.cpp b/src/commands.cpp
index e92d79eaf..985c9ae45 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -84,7 +84,6 @@
#include "utils/delete2.h"
#include "utils/gettext.h"
-#include "utils/mathutils.h"
#include "utils/process.h"
#include "utils/timer.h"
diff --git a/src/gui/popupmanager.cpp b/src/gui/popupmanager.cpp
index b5abb4f04..24c816008 100644
--- a/src/gui/popupmanager.cpp
+++ b/src/gui/popupmanager.cpp
@@ -22,36 +22,14 @@
#include "gui/popupmanager.h"
-#include "actormanager.h"
-#include "configuration.h"
-#include "game.h"
-#include "settings.h"
#include "sdlshared.h"
-#include "textmanager.h"
-#include "resources/mapitemtype.h"
-
-#include "resources/map/map.h"
-#include "resources/map/mapitem.h"
-#include "resources/map/maptype.h"
-#include "resources/map/speciallayer.h"
-
-#include "being/localplayer.h"
-#include "being/playerinfo.h"
-
-#include "input/inputmanager.h"
-
-#include "gui/gui.h"
#include "gui/viewport.h"
-#include "gui/fonts/font.h"
-
#include "gui/popups/beingpopup.h"
#include "gui/popups/popupmenu.h"
#include "gui/popups/textpopup.h"
-#include "gui/windows/ministatuswindow.h"
-
#include "utils/delete2.h"
#include "debug.h"
@@ -200,7 +178,8 @@ void PopupManager::showAttackMonsterPopup(const std::string &name,
void PopupManager::showPickupItemPopup(const std::string &name)
{
- mPopupMenu->showPickupItemPopup(viewport->getMouseX(), viewport->getMouseY(),
+ mPopupMenu->showPickupItemPopup(viewport->getMouseX(),
+ viewport->getMouseY(),
name);
}
diff --git a/src/gui/popupmanager.h b/src/gui/popupmanager.h
index a44625b1e..fcd0f0919 100644
--- a/src/gui/popupmanager.h
+++ b/src/gui/popupmanager.h
@@ -29,9 +29,7 @@ class Being;
class BeingPopup;
class ChatTab;
class FloorItem;
-class Graphics;
class Item;
-class Map;
class MapItem;
class PopupMenu;
class ProgressBar;
diff --git a/src/gui/popups/statuspopup.cpp b/src/gui/popups/statuspopup.cpp
index fd696c568..88b61489f 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -21,16 +21,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "gui/viewport.h"
+#include "gui/popups/statuspopup.h"
#include "gamemodifiers.h"
-#include "gui/popups/statuspopup.h"
-
#include "gui/widgets/label.h"
-#include "being/localplayer.h"
-
#include "input/inputmanager.h"
#include "utils/stringutils.h"
diff --git a/src/gui/popups/statuspopup.h b/src/gui/popups/statuspopup.h
index 6dcdd636f..77cdce12c 100644
--- a/src/gui/popups/statuspopup.h
+++ b/src/gui/popups/statuspopup.h
@@ -25,7 +25,6 @@
#define GUI_POPUPS_STATUSPOPUP_H
#include "input/inputaction.h"
-#include "input/inputactiondata.h"
#include "gui/widgets/popup.h"
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 94c34f483..d0ac02d4c 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -33,7 +33,6 @@
#include "resources/map/map.h"
#include "resources/map/mapitem.h"
-#include "resources/map/maptype.h"
#include "resources/map/speciallayer.h"
#include "being/localplayer.h"
@@ -46,14 +45,8 @@
#include "gui/fonts/font.h"
-#include "gui/popups/beingpopup.h"
-#include "gui/popups/popupmenu.h"
-#include "gui/popups/textpopup.h"
-
#include "gui/windows/ministatuswindow.h"
-#include "utils/delete2.h"
-
#include "debug.h"
Viewport *viewport = nullptr;
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 0347a3f98..329b88074 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -32,21 +32,11 @@
#include "listeners/mouselistener.h"
class ActorSprite;
-class Button;
class Being;
-class BeingPopup;
-class ChatTab;
class FloorItem;
class Graphics;
-class Item;
class Map;
class MapItem;
-class PopupMenu;
-class ProgressBar;
-class TextCommand;
-class TextField;
-class TextPopup;
-class Window;
/** Delay between two mouse calls when dragging mouse and move the player */
const int walkingMouseDelay = 500;
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index d0deb9ba0..e546251fb 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -109,7 +109,7 @@ class GuiTable final : public Widget,
* \param linewise: Whether to enable linewise selection mode
*/
void setLinewiseSelection(bool linewise)
- { mLinewiseMode = linewise;}
+ { mLinewiseMode = linewise; }
// Inherited from Widget
void draw(Graphics* graphics) override final;
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index cdfbac68a..adb455432 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -78,13 +78,10 @@
#include "gui/fonts/font.h"
-#include "gui/popups/popupmenu.h"
-
#include "resources/image.h"
#include "resources/imagerect.h"
#include "utils/copynpaste.h"
-#include "utils/delete2.h"
#include "utils/stringutils.h"
#include "utils/timer.h"
@@ -111,7 +108,6 @@ TextField::TextField(const Widget2 *restrict const widget,
mCaretPosition(0),
mXScroll(0),
mCaretColor(&getThemeColor(Theme::CARET)),
- mPopupMenu(nullptr),
mMinimum(0),
mMaximum(0),
mLastEventPaste(false),
@@ -162,8 +158,6 @@ TextField::~TextField()
if (gui)
gui->removeDragged(this);
- delete2(mPopupMenu);
-
instances--;
if (instances == 0)
{
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index d2cdcd473..e3a893edc 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -74,8 +74,6 @@
#include "localconsts.h"
-class PopupMenu;
-
/**
* A text field.
*
@@ -252,7 +250,6 @@ class TextField notfinal : public Widget,
int mXScroll;
const Color *mCaretColor;
- PopupMenu *mPopupMenu;
static int instances;
static float mAlpha;
static ImageRect skin;
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 02c9b5f2e..ce22252a0 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -51,7 +51,6 @@
#include "resources/iteminfo.h"
#include "utils/delete2.h"
-#include "utils/gettext.h"
#include <algorithm>
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index 82ce553f7..09cf1a95c 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -75,7 +75,6 @@ OutfitWindow::OutfitWindow() :
mKeyLabel(new Label(this, strprintf(_("Key: %s"),
keyName(0).c_str()))),
mBorderColor(getThemeColor(Theme::BORDER, 64)),
- mBackgroundColor(getThemeColor(Theme::BACKGROUND, 32)),
mCurrentOutfit(0),
mBoxWidth(33),
mBoxHeight(33),
@@ -92,6 +91,8 @@ OutfitWindow::OutfitWindow() :
setCloseButton(true);
setStickyButtonLock(true);
+ mBackgroundColor = getThemeColor(Theme::BACKGROUND, 32);
+
setDefaultSize(250, 400, 150, 290);
setMinWidth(145);
setMinHeight(220);
diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h
index cf60c32ad..4bfaa3e84 100644
--- a/src/gui/windows/outfitwindow.h
+++ b/src/gui/windows/outfitwindow.h
@@ -107,7 +107,6 @@ class OutfitWindow final : public Window,
Label *mKeyLabel;
Color mBorderColor;
- Color mBackgroundColor;
int mCurrentOutfit;
int mBoxWidth;
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 6fa51c568..a49545df3 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -36,8 +36,6 @@
#include "being/localplayer.h"
#include "being/playerinfo.h"
-#include "gui/viewport.h"
-
#include "gui/windows/equipmentwindow.h"
#include "gui/windows/setupwindow.h"
@@ -50,6 +48,7 @@
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/statuswindowattrs.h"
#include "gui/widgets/vertcontainer.h"
+#include "gui/widgets/windowcontainer.h"
#include "net/net.h"
#include "net/playerhandler.h"
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 65e14040e..7ee755a5f 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -42,7 +42,6 @@
#include "gui/windows/outfitwindow.h"
#include "gui/windows/socialwindow.h"
#include "gui/windows/killstats.h"
-#include "gui/windows/questswindow.h"
#include "utils/timer.h"
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 4f5200573..225162e9a 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -43,7 +43,6 @@
#include "resources/map/map.h"
-#include "listeners/updatestatuslistener.h"
#include "listeners/playerdeathlistener.h"
#include "listeners/weightlistener.h"
diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp
index 22fbb4ce4..a1bed683a 100644
--- a/src/net/ipc.cpp
+++ b/src/net/ipc.cpp
@@ -28,8 +28,6 @@
#include "utils/sdlhelper.h"
#include "utils/stringutils.h"
-#include <iostream>
-
#include "debug.h"
IPC *ipc = nullptr;
@@ -66,7 +64,7 @@ bool IPC::init()
{
IPaddress ip;
- if(TcpNet::resolveHost(&ip, nullptr, mPort) == -1)
+ if (TcpNet::resolveHost(&ip, nullptr, mPort) == -1)
{
logger->log("IPC: resolveHost error: %s\n", TcpNet::getError());
return false;
@@ -95,7 +93,7 @@ int IPC::acceptLoop(void *ptr)
IPC *const ipc1 = reinterpret_cast<IPC*>(ptr);
const int max_length = 1024;
- TcpNet::SocketSet set = TcpNet::allocSocketSet(1);
+ const TcpNet::SocketSet set = TcpNet::allocSocketSet(1);
TcpNet::addSocket(set, ipc1->mSocket);
ipc->mListen = true;
while (ipc1->mListen)
@@ -104,7 +102,7 @@ int IPC::acceptLoop(void *ptr)
if (!TcpNet::socketReady(ipc1->mSocket))
continue;
- TcpNet::Socket sock = TcpNet::accept(ipc1->mSocket);
+ const TcpNet::Socket sock = TcpNet::accept(ipc1->mSocket);
if (!sock)
{
logger->log_r("IPC: unable to accept connection");
@@ -129,11 +127,11 @@ int IPC::acceptLoop(void *ptr)
ipc1->mThreadLocked = false;
ipc1->mNumReqs ++;
- const std::string resp = strprintf("[%d] %s\n",
+ const std::string resp = strprintf("[%u] %s\n",
ipc1->mNumReqs, req.c_str());
- const char *respc = resp.c_str();
- const int len = strlen(respc) + 1;
+ const char *const respc = resp.c_str();
+ const int len = static_cast<int>(strlen(respc)) + 1;
result = TcpNet::send(sock, respc, len);
if (result < len)
{
@@ -165,13 +163,13 @@ void IPC::start()
unsigned short port(44007);
if (getenv("IPC_PORT"))
- port = atoi(getenv("IPC_PORT"));
+ port = static_cast<unsigned short>(atoi(getenv("IPC_PORT")));
logger->log("Starting IPC...");
ipc = new IPC;
for (int f = port; f < 65535; f ++)
{
- ipc->setPort(f);
+ ipc->setPort(static_cast<unsigned short>(f));
logger->log(" -> trying port %d...", f);
if (ipc->init())
{
diff --git a/src/net/ipc.h b/src/net/ipc.h
index 739eb746e..b1216815b 100644
--- a/src/net/ipc.h
+++ b/src/net/ipc.h
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef IPC_H
-#define IPC_H
+#ifndef NET_IPC_H
+#define NET_IPC_H
#include "net/sdltcpnet.h"
@@ -72,4 +72,4 @@ class IPC final
extern IPC *ipc;
-#endif // IPC_H
+#endif // NET_IPC_H
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index ba469c394..99344e0fd 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -30,7 +30,6 @@
#include "resources/map/mapheights.h"
#include "resources/map/maplayer.h"
#include "resources/map/mapitem.h"
-#include "resources/map/maptype.h"
#include "resources/map/objectslayer.h"
#include "resources/map/speciallayer.h"
#include "resources/map/tileset.h"