summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/outfitwindow.cpp3
-rw-r--r--src/gui/selldialog.cpp12
-rw-r--r--src/gui/setup_video.h3
-rw-r--r--src/gui/viewport.cpp4
-rw-r--r--src/map.h4
-rw-r--r--src/navigationmanager.cpp11
-rw-r--r--src/navigationmanager.h2
-rw-r--r--src/net/eathena/chathandler.cpp2
-rw-r--r--src/net/eathena/chathandler.h2
-rw-r--r--src/net/tmwa/chathandler.cpp2
-rw-r--r--src/net/tmwa/chathandler.h2
-rw-r--r--src/playerrelations.cpp8
-rw-r--r--src/playerrelations.h3
-rw-r--r--src/resources/resourcemanager.cpp2
-rw-r--r--src/safeopenglgraphics.cpp3
-rw-r--r--src/simpleanimation.cpp4
-rw-r--r--src/utils/base64.cpp3
-rw-r--r--src/walklayer.cpp8
18 files changed, 38 insertions, 40 deletions
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index f548116f6..dbe084c17 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -260,13 +260,12 @@ void OutfitWindow::wearOutfit(const int outfit, const bool unwearEmpty,
{
bool isEmpty = true;
- const Item *item;
if (outfit < 0 || outfit > static_cast<int>(OUTFITS_COUNT))
return;
for (unsigned i = 0; i < OUTFIT_ITEM_COUNT; i++)
{
- item = PlayerInfo::getInventory()->findItem(
+ const Item *const item = PlayerInfo::getInventory()->findItem(
mItems[outfit][i], mItemColors[outfit][i]);
if (item && !item->isEquipped() && item->getQuantity())
{
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index cb9a5abf8..e9ec38423 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -226,7 +226,6 @@ void SellDialog::action(const gcn::ActionEvent &event)
{
// Attempt sell
ShopItem *const item = mShopItems->at(selectedItem);
- int sellCount, itemIndex;
mPlayerMoney +=
mAmountItems * mShopItems->at(selectedItem)->getPrice();
mMaxItems -= mAmountItems;
@@ -234,16 +233,17 @@ void SellDialog::action(const gcn::ActionEvent &event)
{
// This order is important, item->getCurrentInvIndex() would return
// the inventory index of the next Duplicate otherwise.
- itemIndex = item->getCurrentInvIndex();
- sellCount = item->sellCurrentDuplicate(mAmountItems);
-
+ const int sellCount = item->sellCurrentDuplicate(mAmountItems);
#ifdef MANASERV_SUPPORT
+ int itemIndex = item->getCurrentInvIndex();
// For Manaserv, the Item id is to be given as index.
if ((Net::getNetworkType() == ServerInfo::MANASERV))
itemIndex = item->getId();
-#endif
-
Net::getNpcHandler()->sellItem(mNpcId, itemIndex, sellCount);
+#else
+ Net::getNpcHandler()->sellItem(mNpcId,
+ item->getCurrentInvIndex(), sellCount);
+#endif
mAmountItems -= sellCount;
}
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 8ccfa5bb2..dc1a180b3 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -70,9 +70,6 @@ class Setup_Video final : public SetupTab, public gcn::KeyListener
OpenGLListModel *mOpenGLListModel;
- Label *scrollRadiusLabel;
- Label *scrollLazinessLabel;
-
ListBox *mModeList;
CheckBox *mFsCheckBox;
DropDown *mOpenGLDropDown;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 2e4ff851b..e7e0a2766 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -152,10 +152,10 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
if (mScrollLaziness < 1)
mScrollLaziness = 1; // Avoids division by zero
- int cnt = 0;
-
if (mEnableLazyScrolling)
{
+ int cnt = 0;
+
// Apply lazy scrolling
while (lastTick < tick_time && cnt < 32)
{
diff --git a/src/map.h b/src/map.h
index 2c5e0ff9c..a449bbc6b 100644
--- a/src/map.h
+++ b/src/map.h
@@ -411,8 +411,8 @@ class Map final : public Properties, public ConfigListener
WalkLayer *getWalkLayer()
{ return mWalkLayer; }
- void setWalkLayer(WalkLayer *l)
- { mWalkLayer = l; }
+ void setWalkLayer(WalkLayer *const layer)
+ { mWalkLayer = layer; }
protected:
friend class Actor;
diff --git a/src/navigationmanager.cpp b/src/navigationmanager.cpp
index 38dd0f718..46d930efc 100644
--- a/src/navigationmanager.cpp
+++ b/src/navigationmanager.cpp
@@ -23,12 +23,11 @@
#include "map.h"
#include "walklayer.h"
-#include "resources/resource.h"
-
static const int walkMask = (Map::BLOCKMASK_WALL | Map::BLOCKMASK_AIR
| Map::BLOCKMASK_WATER);
-namespace {
+namespace
+{
struct Cell
{
Cell(const int x0, const int y0) :
@@ -50,7 +49,7 @@ NavigationManager::~NavigationManager()
{
}
-Resource *NavigationManager::loadWalkLayer(Map *const map)
+Resource *NavigationManager::loadWalkLayer(const Map *const map)
{
if (!map)
return nullptr;
@@ -62,12 +61,12 @@ Resource *NavigationManager::loadWalkLayer(Map *const map)
WalkLayer *const walkLayer = new WalkLayer(width, height);
const MetaTile *const tiles = map->getMetaTiles();
- int *data = walkLayer->getData();
+ int *const data = walkLayer->getData();
int x = 0;
int y = 0;
int num = 1;
- while(findWalkableTile(x, y, width, height,tiles, data))
+ while (findWalkableTile(x, y, width, height, tiles, data))
{
fillNum(x, y, width, height, num, tiles, data);
num ++;
diff --git a/src/navigationmanager.h b/src/navigationmanager.h
index c08f4acd5..6af9e45a6 100644
--- a/src/navigationmanager.h
+++ b/src/navigationmanager.h
@@ -36,7 +36,7 @@ class NavigationManager final
~NavigationManager();
- static Resource *loadWalkLayer(Map *const map);
+ static Resource *loadWalkLayer(const Map *const map);
private:
static bool findWalkableTile(int &x1, int &y1,
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 0f62411b3..55941e030 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -175,7 +175,7 @@ void ChatHandler::sendRaw(const std::string &args)
delete outMsg;
}
-void ChatHandler::processRaw(MessageOut &outMsg, std::string &line)
+void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
{
size_t pos = line.find(":");
if (pos == std::string::npos)
diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h
index 8a278bc29..928b7aeb0 100644
--- a/src/net/eathena/chathandler.h
+++ b/src/net/eathena/chathandler.h
@@ -57,7 +57,7 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler
void unIgnoreAll();
- void processRaw(MessageOut &outMsg, std::string &line);
+ void processRaw(MessageOut &outMsg, const std::string &line);
};
} // namespace EAthena
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index b44c5bf73..b04d1604c 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -201,7 +201,7 @@ void ChatHandler::sendRaw(const std::string &args)
delete outMsg;
}
-void ChatHandler::processRaw(MessageOut &outMsg, std::string &line)
+void ChatHandler::processRaw(MessageOut &outMsg, const std::string &line)
{
size_t pos = line.find(":");
if (pos == std::string::npos)
diff --git a/src/net/tmwa/chathandler.h b/src/net/tmwa/chathandler.h
index 0359e9f13..733010b37 100644
--- a/src/net/tmwa/chathandler.h
+++ b/src/net/tmwa/chathandler.h
@@ -57,7 +57,7 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler
void unIgnoreAll();
- void processRaw(MessageOut &outMsg, std::string &line);
+ void processRaw(MessageOut &outMsg, const std::string &line);
};
} // namespace TmwAthena
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 1e68eef5d..218b1e50a 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -466,7 +466,7 @@ public:
}
virtual void ignore(Being *const being A_UNUSED,
- const unsigned int flags A_UNUSED) override
+ const unsigned int flags A_UNUSED) const override
{
}
};
@@ -482,7 +482,7 @@ public:
}
virtual void ignore(Being *const being,
- const unsigned int flags A_UNUSED) override
+ const unsigned int flags A_UNUSED) const override
{
if (!being)
return;
@@ -504,7 +504,7 @@ public:
}
virtual void ignore(Being *const being,
- const unsigned int flags A_UNUSED) override
+ const unsigned int flags A_UNUSED) const override
{
if (!being)
return;
@@ -527,7 +527,7 @@ public:
}
virtual void ignore(Being *const being,
- const unsigned int flags A_UNUSED) override
+ const unsigned int flags A_UNUSED) const override
{
if (!being)
return;
diff --git a/src/playerrelations.h b/src/playerrelations.h
index fb185ce60..ff28b5c83 100644
--- a/src/playerrelations.h
+++ b/src/playerrelations.h
@@ -85,7 +85,8 @@ class PlayerIgnoreStrategy
/**
* Handle the ignoring of the indicated action by the indicated player.
*/
- virtual void ignore(Being *const being, const unsigned int flags) = 0;
+ virtual void ignore(Being *const being,
+ const unsigned int flags) const = 0;
};
class PlayerRelationsListener
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 43092e28d..ef5ccf128 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -1147,4 +1147,6 @@ void ResourceManager::deleteFilesInDirectory(std::string path)
if (file != "." && file != "..")
remove(name.c_str());
}
+ if (dir)
+ closedir(dir);
}
diff --git a/src/safeopenglgraphics.cpp b/src/safeopenglgraphics.cpp
index 0cd00d60d..8d37e5da2 100644
--- a/src/safeopenglgraphics.cpp
+++ b/src/safeopenglgraphics.cpp
@@ -106,7 +106,8 @@ static inline void drawRescaledQuad(const Image *const image,
const int srcX, const int srcY,
const int dstX, const int dstY,
const int width, const int height,
- const int desiredWidth, const int desiredHeight)
+ const int desiredWidth,
+ const int desiredHeight)
{
if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D)
{
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 91f491ffe..14996f577 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -97,7 +97,7 @@ void SimpleAnimation::setFrame(int frame)
if (frame < 0)
frame = 0;
- const unsigned int len = mAnimation->getLength();
+ const unsigned int len = static_cast<unsigned>(mAnimation->getLength());
if (static_cast<unsigned>(frame) >= len)
frame = len - 1;
mAnimationPhase = frame;
@@ -106,7 +106,7 @@ void SimpleAnimation::setFrame(int frame)
bool SimpleAnimation::update(const int timePassed)
{
- if (!mCurrentFrame || !mAnimation || !mInitialized || !mAnimation)
+ if (!mCurrentFrame || !mAnimation || !mInitialized)
return false;
bool updated(false);
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
index fe3d1cb90..7cd22f732 100644
--- a/src/utils/base64.cpp
+++ b/src/utils/base64.cpp
@@ -97,7 +97,6 @@ unsigned char *php3_base64_decode(const unsigned char *const string,
{
const unsigned char *current = string;
int ch, i = 0, j = 0, k;
- const char *chp;
unsigned char *result = static_cast<unsigned char *>(
calloc(length + 1, 1));
@@ -120,7 +119,7 @@ unsigned char *php3_base64_decode(const unsigned char *const string,
if (ch == ' ') ch = '+';
- chp = strchr(base64_table, ch);
+ const char *const chp = strchr(base64_table, ch);
if (!chp)
continue;
ch = static_cast<int>(chp - base64_table);
diff --git a/src/walklayer.cpp b/src/walklayer.cpp
index 6a18ba205..53ac31048 100644
--- a/src/walklayer.cpp
+++ b/src/walklayer.cpp
@@ -23,12 +23,12 @@
#include "debug.h"
WalkLayer::WalkLayer(const int width, const int height) :
+ Resource(),
mWidth(width),
- mHeight(height)
+ mHeight(height),
+ mTiles(new int[width * height])
{
- const int sz = width * height;
- mTiles = new int[sz];
- std::fill_n(mTiles, sz, 0);
+ std::fill_n(mTiles, width * height, 0);
}
WalkLayer::~WalkLayer()