summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actionmanager.cpp4
-rw-r--r--src/actor.h2
-rw-r--r--src/actorspritemanager.cpp4
-rw-r--r--src/actorspritemanager.h2
-rw-r--r--src/being.cpp6
-rw-r--r--src/being.h2
-rw-r--r--src/channel.h2
-rw-r--r--src/chatlogger.cpp1
-rw-r--r--src/client.cpp6
-rw-r--r--src/configuration.h2
-rw-r--r--src/equipment.h2
-rw-r--r--src/game.cpp4
-rw-r--r--src/graphicsvertexes.cpp2
-rw-r--r--src/graphicsvertexes.h2
-rw-r--r--src/gui/quitdialog.cpp2
-rw-r--r--src/gui/sdlfont.cpp4
-rw-r--r--src/gui/shopwindow.cpp1
-rw-r--r--src/gui/theme.cpp2
-rw-r--r--src/gui/updaterwindow.cpp8
-rw-r--r--src/gui/updaterwindow.h4
-rw-r--r--src/localplayer.cpp2
-rw-r--r--src/map.cpp5
-rw-r--r--src/map.h2
-rw-r--r--src/maplayer.cpp18
-rw-r--r--src/maplayer.h4
-rw-r--r--src/net/ea/buysellhandler.cpp3
-rw-r--r--src/net/ea/network.cpp2
-rw-r--r--src/net/ea/network.h2
-rw-r--r--src/net/eathena/charserverhandler.cpp5
-rw-r--r--src/net/tmwa/beinghandler.cpp3
-rw-r--r--src/particleemitter.cpp4
-rw-r--r--src/playerrelations.cpp4
-rw-r--r--src/resources/ambientlayer.cpp3
-rw-r--r--src/resources/beinginfo.h4
-rw-r--r--src/resources/image.cpp3
-rw-r--r--src/resources/itemdb.cpp3
-rw-r--r--src/resources/mapreader.cpp3
-rw-r--r--src/resources/resourcemanager.cpp25
-rw-r--r--src/resources/resourcemanager.h11
-rw-r--r--src/resources/sdlimagehelper.cpp2
-rw-r--r--src/resources/sdlimagehelper.h2
-rw-r--r--src/resources/spritedef.cpp2
-rw-r--r--src/resources/spritedef.h2
-rw-r--r--src/resources/wallpaper.cpp2
-rw-r--r--src/spellmanager.cpp6
-rw-r--r--src/spellmanager.h2
-rw-r--r--src/textmanager.cpp3
-rw-r--r--src/utils/physfsrwops.cpp2
-rw-r--r--src/utils/translation/poparser.cpp2
49 files changed, 99 insertions, 94 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 13b9bb956..3cb49f340 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -979,10 +979,10 @@ impHandler0(attack)
impHandler0(targetAttack)
{
- Being *target = nullptr;
-
if (player_node && actorSpriteManager)
{
+ Being *target = nullptr;
+
const bool newTarget = !inputManager.isActionActive(
Input::KEY_STOP_ATTACK);
// A set target has highest priority
diff --git a/src/actor.h b/src/actor.h
index c2529ac7d..ec9b44ce3 100644
--- a/src/actor.h
+++ b/src/actor.h
@@ -122,7 +122,7 @@ public:
void setMap(Map *const map);
- Map* getMap() const
+ const Map* getMap() const
{ return mMap; }
protected:
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 61fd35c95..73d522527 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -692,7 +692,7 @@ Being *ActorSpriteManager::findBeingByName(const std::string &name,
}
Being *ActorSpriteManager::findNearestByName(const std::string &name,
- const Being::Type type) const
+ const Being::Type &type) const
{
if (!player_node)
return nullptr;
@@ -847,7 +847,6 @@ Being *ActorSpriteManager::findNearestLivingBeing(const Being *const
if (!aroundBeing || !player_node)
return nullptr;
- Being *closestBeing = nullptr;
std::set<std::string> attackMobs;
std::set<std::string> priorityMobs;
std::set<std::string> ignoreAttackMobs;
@@ -995,6 +994,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(const Being *const
{
int dist = 0;
int index = defaultPriorityIndex;
+ Being *closestBeing = nullptr;
for (ActorSprites::const_iterator i = mActors.begin(),
i_end = mActors.end();
diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h
index a5ae7e6d8..cc73fe6de 100644
--- a/src/actorspritemanager.h
+++ b/src/actorspritemanager.h
@@ -154,7 +154,7 @@ class ActorSpriteManager: public ConfigListener
* Finds a nearest being by name and (optionally) by type.
*/
Being *findNearestByName(const std::string &name,
- const Being::Type type = Being::UNKNOWN
+ const Being::Type &type = Being::UNKNOWN
) const;
/**
diff --git a/src/being.cpp b/src/being.cpp
index ce6ec1a0e..4ca664dc6 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2267,7 +2267,7 @@ void Being::recalcSpritesOrder()
mSpriteHide[remSprite] = repIt->second;
if (repIt->second != 1)
{
- if (remSprite != hairSlot)
+ if ((unsigned)remSprite != hairSlot)
{
setSprite(remSprite, repIt->second,
mSpriteColors[remSprite],
@@ -2558,7 +2558,7 @@ std::string Being::loadComment(const std::string &name, const int type)
logger->log("load from: %s", str.c_str());
StringVect lines;
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
if (resman->existsLocal(str))
{
lines = resman->loadTextFileLocal(str);
@@ -2584,7 +2584,7 @@ void Being::saveComment(const std::string &name,
return;
}
dir += stringToHexPath(name);
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
resman->saveTextFile(dir, "comment.txt", name + "\n" + comment);
}
diff --git a/src/being.h b/src/being.h
index 8c1fc81f9..e03607283 100644
--- a/src/being.h
+++ b/src/being.h
@@ -465,7 +465,7 @@ class Being : public ActorSprite, public ConfigListener
* in pixels per second for eAthena,
* in tiles per second for Manaserv.
*/
- void setWalkSpeed(const Vector speed)
+ void setWalkSpeed(const Vector &speed)
{ mWalkSpeed = speed; }
/**
diff --git a/src/channel.h b/src/channel.h
index 1df0e3204..7d00beb48 100644
--- a/src/channel.h
+++ b/src/channel.h
@@ -73,7 +73,7 @@ class Channel
void setAnnouncement(const std::string &channelAnnouncement)
{ mAnnouncement = channelAnnouncement; }
- ChannelTab *getTab() const
+ const ChannelTab *getTab() const
{ return mTab; }
protected:
diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp
index 8d12852a5..23a0e4aef 100644
--- a/src/chatlogger.cpp
+++ b/src/chatlogger.cpp
@@ -103,7 +103,6 @@ void ChatLogger::log(std::string str)
void ChatLogger::log(std::string name, std::string str)
{
- std::ofstream logFile;
std::string dateStr = getDir();
std::string logFileName = strprintf("%s/%s.log",
dateStr.c_str(), secureName(name).c_str());
diff --git a/src/client.cpp b/src/client.cpp
index 468f06f10..43d5650bb 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -399,7 +399,7 @@ void Client::gameInit()
SMALL_VERSION).c_str(), nullptr);
}
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
if (!resman->setWriteDir(mLocalDataDir))
{
@@ -1200,7 +1200,7 @@ int Client::gameExec()
{
logger->log1("State: LOAD DATA");
- ResourceManager *const resman
+ const ResourceManager *const resman
= ResourceManager::getInstance();
// If another data path has been set,
@@ -1889,7 +1889,7 @@ void Client::initUpdatesDir()
replaceAll(mUpdatesDir, ":", "_");
#endif
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
// Verify that the updates directory exists. Create if necessary.
if (!resman->isDirectory("/" + mUpdatesDir))
diff --git a/src/configuration.h b/src/configuration.h
index 7435f8596..e2e18375c 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -65,7 +65,7 @@ class ConfigurationListManager
* \param obj The configuration object to read from
* \param container The container to insert the object to
*/
- virtual CONT readConfigItem(ConfigurationObject *obj,
+ virtual CONT readConfigItem(ConfigurationObject *const obj,
CONT container) = 0;
virtual ~ConfigurationListManager() {}
diff --git a/src/equipment.h b/src/equipment.h
index 176790f0f..5b38a7f2d 100644
--- a/src/equipment.h
+++ b/src/equipment.h
@@ -93,7 +93,7 @@ class Equipment
void setBackend(Backend *const backend)
{ mBackend = backend; }
- Backend *getBackend() const
+ const Backend *getBackend() const
{ return mBackend; }
private:
diff --git a/src/game.cpp b/src/game.cpp
index 3672a3ea8..c0e69bb75 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -606,7 +606,7 @@ void Game::slowLogic()
if (viewport && !errorMessage.empty())
{
- Map *const map = viewport->getCurrentMap();
+ const Map *const map = viewport->getCurrentMap();
if (map)
{
logger->log("state: %d", Client::getState());
@@ -979,7 +979,7 @@ void Game::changeMap(const std::string &mapPath)
std::string realFullMap = paths.getValue("maps", "maps/")
+ MapDB::getMapName(mMapName) + ".tmx";
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
if (!resman->exists(realFullMap))
realFullMap += ".gz";
diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp
index b6451a3e4..4c144cad0 100644
--- a/src/graphicsvertexes.cpp
+++ b/src/graphicsvertexes.cpp
@@ -213,7 +213,7 @@ void GraphicsVertexes::setLoadAsOpenGL(int useOpenGL)
}
#endif
-void GraphicsVertexes::pushSDL(const SDL_Rect r1, const SDL_Rect r2)
+void GraphicsVertexes::pushSDL(const SDL_Rect &r1, const SDL_Rect &r2)
{
DoubleRect *const r = new DoubleRect();
r->src = r1;
diff --git a/src/graphicsvertexes.h b/src/graphicsvertexes.h
index f0c19d4bc..4a4fd37f9 100644
--- a/src/graphicsvertexes.h
+++ b/src/graphicsvertexes.h
@@ -153,7 +153,7 @@ class GraphicsVertexes
void init(const int x, const int y, const int w, const int h);
- void pushSDL(const SDL_Rect r1, const SDL_Rect r2);
+ void pushSDL(const SDL_Rect &r1, const SDL_Rect &r2);
void clearSDL();
diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp
index c84ddc122..d5a4d8504 100644
--- a/src/gui/quitdialog.cpp
+++ b/src/gui/quitdialog.cpp
@@ -126,7 +126,7 @@ void QuitDialog::action(const gcn::ActionEvent &event)
{
if (viewport)
{
- Map *const map = viewport->getCurrentMap();
+ const Map *const map = viewport->getCurrentMap();
if (map)
map->saveExtraLayer();
}
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index ed3a6b295..2dbf880a5 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -100,7 +100,7 @@ SDLFont::SDLFont(std::string filename, const int size, const int style) :
mCreateCounter(0),
mDeleteCounter(0)
{
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
if (fontCounter == 0 && TTF_Init() == -1)
{
@@ -151,7 +151,7 @@ SDLFont::~SDLFont()
void SDLFont::loadFont(std::string filename, const int size, const int style)
{
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
if (fontCounter == 0 && TTF_Init() == -1)
{
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index a75b8d810..9ebe7a2a5 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -400,7 +400,6 @@ void ShopWindow::saveList()
std::ofstream shopFile;
std::string shopListName = Client::getServerConfigDirectory()
+ "/shoplist.txt";
- std::list<int> procesList;
std::map<int, ShopItem*> mapItems;
shopFile.open(shopListName.c_str(), std::ios::binary);
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 91a6720e0..679b975e0 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -50,7 +50,7 @@ Theme *Theme::mInstance = nullptr;
// Set the theme path...
static void initDefaultThemePath()
{
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
defaultThemePath = branding.getStringValue("guiThemePath");
logger->log("defaultThemePath: " + defaultThemePath);
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 71e2a1022..496e651b3 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -514,7 +514,7 @@ void UpdaterWindow::download()
void UpdaterWindow::loadUpdates()
{
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
if (mUpdateFiles.empty())
{ // updates not downloaded
@@ -540,7 +540,7 @@ void UpdaterWindow::loadUpdates()
void UpdaterWindow::loadLocalUpdates(const std::string &dir)
{
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
std::vector<updateFile> updateFiles
= loadXMLFile(dir + "/" + xmlUpdateFile);
@@ -564,7 +564,7 @@ void UpdaterWindow::loadLocalUpdates(const std::string &dir)
}
void UpdaterWindow::loadManaPlusUpdates(const std::string &dir,
- ResourceManager *const resman)
+ const ResourceManager *const resman)
{
std::string fixPath = dir + "/fix";
std::vector<updateFile> updateFiles
@@ -584,7 +584,7 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir,
}
}
-void UpdaterWindow::addUpdateFile(ResourceManager *const resman,
+void UpdaterWindow::addUpdateFile(const ResourceManager *const resman,
const std::string &path,
const std::string &fixPath,
const std::string &file,
diff --git a/src/gui/updaterwindow.h b/src/gui/updaterwindow.h
index 616b0d824..c7534dece 100644
--- a/src/gui/updaterwindow.h
+++ b/src/gui/updaterwindow.h
@@ -119,14 +119,14 @@ class UpdaterWindow : public Window,
static void loadLocalUpdates(const std::string &dir);
- static void addUpdateFile(ResourceManager *const resman,
+ static void addUpdateFile(const ResourceManager *const resman,
const std::string &path,
const std::string &fixPath,
const std::string &file,
const bool append);
static void loadManaPlusUpdates(const std::string &dir,
- ResourceManager *const resman);
+ const ResourceManager *const resman);
int updateState;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 5a5c87221..61764fc40 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -3594,7 +3594,7 @@ void LocalPlayer::navigateClean()
mNavigatePath.clear();
- SpecialLayer *const tmpLayer = mMap->getTempLayer();
+ const SpecialLayer *const tmpLayer = mMap->getTempLayer();
if (!tmpLayer)
return;
diff --git a/src/map.cpp b/src/map.cpp
index 88396b4aa..16f284e95 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1081,7 +1081,6 @@ void Map::initializeParticleEffects(Particle *const engine)
if (!engine)
return;
- Particle *p;
if (config.getBoolValue("particleeffects"))
{
@@ -1089,7 +1088,7 @@ void Map::initializeParticleEffects(Particle *const engine)
i = particleEffects.begin();
i != particleEffects.end(); ++i)
{
- p = engine->addEffect(i->file, i->x, i->y);
+ Particle *const p = engine->addEffect(i->file, i->x, i->y);
if (p && i->w > 0 && i->h > 0)
p->adjustEmitterSize(i->w, i->h);
}
@@ -1322,7 +1321,7 @@ void Map::setPvpMode(const int mode)
}
std::string Map::getObjectData(const unsigned x, const unsigned y,
- const int type)
+ const int type) const
{
if (!mObjects)
return "";
diff --git a/src/map.h b/src/map.h
index 5cd1cf8ed..02c7ccbc5 100644
--- a/src/map.h
+++ b/src/map.h
@@ -364,7 +364,7 @@ class Map : public Properties, public ConfigListener
{ return mObjects; }
std::string getObjectData(const unsigned x, const unsigned y,
- const int type);
+ const int type) const;
void indexTilesets();
diff --git a/src/maplayer.cpp b/src/maplayer.cpp
index 13ded2f83..f7db290b6 100644
--- a/src/maplayer.cpp
+++ b/src/maplayer.cpp
@@ -115,7 +115,7 @@ void MapLayer::draw(Graphics *const graphics,
const int x32 = x * 32;
int c = 0;
- Image *const img = *tilePtr;
+ const Image *const img = *tilePtr;
if (img)
{
const int px = x32 + dx;
@@ -378,7 +378,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
{
const int px1 = x * 32 - scrollX;
- MapItem *item = mSpecialLayer->mTiles[ptr + x];
+ const MapItem *item = mSpecialLayer->mTiles[ptr + x];
if (item)
item->draw(graphics, px1, py1, 32, 32);
@@ -400,7 +400,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
const int px1 = x32 - scrollX;
int c = 0;
- Image *const img = *tilePtr;
+ const Image *const img = *tilePtr;
if (img)
{
const int px = x32 + dx;
@@ -437,8 +437,10 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
for (int x1 = 0; x1 < c1 + 1; x1 ++)
{
- MapItem *const item1 = mSpecialLayer->mTiles[ptr + x1];
- MapItem *const item2 = mTempLayer->mTiles[ptr + x1];
+ const MapItem *const item1
+ = mSpecialLayer->mTiles[ptr + x1];
+ const MapItem *const item2
+ = mTempLayer->mTiles[ptr + x1];
if (item1 || item2)
{
const int px2 = px1 + (x1 * 32);
@@ -604,7 +606,7 @@ void SpecialLayer::addRoad(Path road)
}
}
-void SpecialLayer::clean()
+void SpecialLayer::clean() const
{
if (!mTiles)
return;
@@ -619,7 +621,7 @@ void SpecialLayer::clean()
void SpecialLayer::draw(Graphics *const graphics, int startX, int startY,
int endX, int endY,
- const int scrollX, const int scrollY)
+ const int scrollX, const int scrollY) const
{
if (startX < 0)
startX = 0;
@@ -640,7 +642,7 @@ void SpecialLayer::draw(Graphics *const graphics, int startX, int startY,
void SpecialLayer::itemDraw(Graphics *const graphics, const int x, const int y,
const int scrollX, const int scrollY) const
{
- MapItem *const item = getTile(x, y);
+ const MapItem *const item = getTile(x, y);
if (item)
{
const int px = x * 32 - scrollX;
diff --git a/src/maplayer.h b/src/maplayer.h
index 9c2b0630e..fa6bd3e15 100644
--- a/src/maplayer.h
+++ b/src/maplayer.h
@@ -190,7 +190,7 @@ class SpecialLayer
void draw(Graphics *const graphics, int startX, int startY,
int endX, int endY,
- const int scrollX, const int scrollY);
+ const int scrollX, const int scrollY) const;
MapItem* getTile(const int x, const int y) const;
@@ -200,7 +200,7 @@ class SpecialLayer
void addRoad(Path road);
- void clean();
+ void clean() const;
void itemDraw(Graphics *const graphics, const int x, const int y,
const int scrollX, const int scrollY) const;
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp
index 9cee4d434..7a66df305 100644
--- a/src/net/ea/buysellhandler.cpp
+++ b/src/net/ea/buysellhandler.cpp
@@ -151,7 +151,8 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg, int offset)
const int value = msg.readInt32();
msg.readInt32(); // value
- const Item *const item = PlayerInfo::getInventory()->getItem(index);
+ const Item *const item = PlayerInfo::getInventory()
+ ->getItem(index);
if (item && !(item->isEquipped()))
dialog->addItem(item, value);
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index 679ff450d..69c27d792 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -318,7 +318,7 @@ void Network::setError(const std::string &error)
mState = NET_ERROR;
}
-uint16_t Network::readWord(int pos)
+uint16_t Network::readWord(const int pos) const
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
return SDL_Swap16((*(uint16_t*)(mInBuffer + (pos))));
diff --git a/src/net/ea/network.h b/src/net/ea/network.h
index 913af7e6b..d61332fe1 100644
--- a/src/net/ea/network.h
+++ b/src/net/ea/network.h
@@ -84,7 +84,7 @@ class Network
void setError(const std::string &error);
- uint16_t readWord(int pos);
+ uint16_t readWord(const int pos) const;
bool realConnect();
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 2d98eaa6a..69ccc59a4 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -202,7 +202,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
msg.readInt16(); // speed
tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
const int hairStyle = msg.readInt16();
- const uint16_t weapon = msg.readInt16(); // server not used it. may be need use?
+ const uint16_t weapon = msg.readInt16();
+
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
data.mAttributes[PlayerInfo::LEVEL] = msg.readInt16();
@@ -211,7 +212,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
const int bottomClothes = msg.readInt16();
const int shield = msg.readInt16();
- int hat = msg.readInt16(); // head option top
+ const int hat = msg.readInt16(); // head option top
const int topClothes = msg.readInt16();
tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1,
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index f816c9e04..37ce67213 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -443,9 +443,8 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType)
// An update about a player, potentially including movement.
const int id = msg.readInt32();
const short speed = msg.readInt16();
- const uint16_t stunMode = msg.readInt16(); // opt1; Aethyra use this as cape
+ const uint16_t stunMode = msg.readInt16(); // opt1;
uint32_t statusEffects = msg.readInt16(); // opt2;
- // Aethyra use this as misc1
statusEffects |= (static_cast<uint32_t>(msg.readInt16()))
<< 16; // status.options; Aethyra uses this as misc2
const short job = msg.readInt16();
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 8fbb5eca3..026255c9f 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -304,9 +304,9 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
{
const int delay = XML::getIntProperty(
frameNode, "delay", 0, 0, 100000);
- int offsetX = XML::getProperty(frameNode, "offsetX", 0)
+ const int offsetX = XML::getProperty(frameNode, "offsetX", 0)
- (imageset->getWidth() / 2 - 16);
- int offsetY = XML::getProperty(frameNode, "offsetY", 0)
+ const int offsetY = XML::getProperty(frameNode, "offsetY", 0)
- (imageset->getHeight() - 32);
const int rand = XML::getIntProperty(
frameNode, "rand", 100, 0, 100);
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index e85fd21b6..6f244e5ab 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -84,7 +84,7 @@ public:
}
virtual std::map<std::string, PlayerRelation *> *
- readConfigItem(ConfigurationObject *cobj,
+ readConfigItem(ConfigurationObject *const cobj,
std::map<std::string, PlayerRelation *> *container)
{
if (!cobj)
@@ -298,7 +298,7 @@ unsigned int PlayerRelationsManager::checkPermissionSilently(
}
bool PlayerRelationsManager::hasPermission(const Being *const being,
- unsigned int flags)
+ const unsigned int flags)
{
if (!being)
return false;
diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp
index 9e919297b..99a3b76c4 100644
--- a/src/resources/ambientlayer.cpp
+++ b/src/resources/ambientlayer.cpp
@@ -102,7 +102,8 @@ void AmbientLayer::update(const int timePassed, const float dx, const float dy)
mPosY += static_cast<float>(imgH);
}
-void AmbientLayer::draw(Graphics *const graphics, const int x, const int y) const
+void AmbientLayer::draw(Graphics *const graphics, const int x,
+ const int y) const
{
if (!mImage)
return;
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 130cb26ea..2d5971f91 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -90,7 +90,7 @@ class BeingInfo
void setTargetCursorSize(const std::string &size);
void setTargetCursorSize(const ActorSprite::TargetCursorSize
- targetSize)
+ &targetSize)
{ mTargetCursorSize = targetSize; }
ActorSprite::TargetCursorSize getTargetCursorSize() const
@@ -115,7 +115,7 @@ class BeingInfo
unsigned char getWalkMask() const
{ return mWalkMask; }
- void setBlockType(const Map::BlockType blockType)
+ void setBlockType(const Map::BlockType &blockType)
{ mBlockType = blockType; }
Map::BlockType getBlockType() const
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 33b97b633..e70ee3de5 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -299,11 +299,10 @@ Image* Image::SDLgetScaledImage(const int width, const int height) const
return nullptr;
Image* scaledImage = nullptr;
- SDL_Surface* scaledSurface = nullptr;
if (mSDLSurface)
{
- scaledSurface = zoomSurface(mSDLSurface,
+ SDL_Surface *const scaledSurface = zoomSurface(mSDLSurface,
static_cast<double>(width) / mBounds.w,
static_cast<double>(height) / mBounds.h,
1);
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 5905ef578..8fd4a9fdc 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -242,7 +242,8 @@ void ItemDB::load()
node, "missile-particle", "");
const int hitEffectId = XML::getProperty(node, "hit-effect-id",
paths.getIntValue("hitEffectId"));
- const int criticalEffectId = XML::getProperty(node, "critical-hit-effect-id",
+ const int criticalEffectId = XML::getProperty(
+ node, "critical-hit-effect-id",
paths.getIntValue("criticalHitEffectId"));
SpriteDisplay display;
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 8a193a627..f133e273d 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -755,7 +755,8 @@ Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path,
continue;
std::string name = XML::getProperty(
propertyNode, "name", "");
- const int value = XML::getProperty(propertyNode, "value", 0);
+ const int value = XML::getProperty(
+ propertyNode, "value", 0);
if (!name.empty())
{
tileProperties[name] = value;
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 2f3d96d27..1edd7b6de 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -257,7 +257,7 @@ bool ResourceManager::removeFromSearchPath(const std::string &path) const
void ResourceManager::searchAndAddArchives(const std::string &path,
const std::string &ext,
- const bool append)
+ const bool append) const
{
const char *const dirSep = PHYSFS_getDirSeparator();
char **list = PHYSFS_enumerateFiles(path.c_str());
@@ -282,7 +282,7 @@ void ResourceManager::searchAndAddArchives(const std::string &path,
}
void ResourceManager::searchAndRemoveArchives(const std::string &path,
- const std::string &ext)
+ const std::string &ext) const
{
const char *const dirSep = PHYSFS_getDirSeparator();
char **list = PHYSFS_enumerateFiles(path.c_str());
@@ -398,7 +398,7 @@ Resource *ResourceManager::getFromCache(const std::string &idPath)
}
Resource *ResourceManager::get(const std::string &idPath, const generator fun,
- void *const data)
+ const void *const data)
{
#ifndef DISABLE_RESOURCE_CACHING
Resource *resource = getFromCache(idPath);
@@ -437,7 +437,7 @@ struct ResourceLoader
std::string path;
ResourceManager::loader fun;
- static Resource *load(void *const v)
+ static Resource *load(const void *const v)
{
if (!v)
return nullptr;
@@ -471,7 +471,7 @@ struct DyedImageLoader
{
ResourceManager *manager;
std::string path;
- static Resource *load(void *const v)
+ static Resource *load(const void *const v)
{
if (!v)
return nullptr;
@@ -528,7 +528,7 @@ struct ImageSetLoader
ResourceManager *manager;
std::string path;
int w, h;
- static Resource *load(void *const v)
+ static Resource *load(const void *const v)
{
if (!v)
return nullptr;
@@ -562,7 +562,7 @@ struct SubImageSetLoader
ResourceManager *manager;
Image *parent;
int width, height;
- static Resource *load(void *v)
+ static Resource *load(const void *const v)
{
if (!v)
return nullptr;
@@ -597,7 +597,7 @@ struct SubImageLoader
Image *parent;
int x, y;
int width, height;
- static Resource *load(void *const v)
+ static Resource *load(const void *const v)
{
if (!v)
return nullptr;
@@ -632,7 +632,7 @@ struct SpriteDefLoader
{
std::string path;
int variant;
- static Resource *load(void *const v)
+ static Resource *load(const void *const v)
{
if (!v)
return nullptr;
@@ -840,7 +840,7 @@ SDL_Surface *ResourceManager::loadSDLSurface(const std::string &filename) const
return surface;
}
-void ResourceManager::scheduleDelete(SDL_Surface* surface)
+void ResourceManager::scheduleDelete(SDL_Surface *const surface)
{
deletedSurfaces.insert(surface);
}
@@ -861,11 +861,12 @@ struct RescaledLoader
Image *image;
int width;
int height;
- static Resource *load(void *const v)
+ static Resource *load(const void *const v)
{
if (!v)
return nullptr;
- const RescaledLoader *const rl = static_cast< RescaledLoader * >(v);
+ const RescaledLoader *const rl
+ = static_cast<const RescaledLoader *const>(v);
if (!rl->manager || !rl->image)
return nullptr;
Image *const rescaled = rl->image->SDLgetScaledImage(
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 540e5f882..dee7f5459 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -56,7 +56,7 @@ class ResourceManager
public:
typedef Resource *(*loader)(SDL_RWops *);
- typedef Resource *(*generator)(void *);
+ typedef Resource *(*generator)(const void *const);
ResourceManager();
@@ -95,13 +95,13 @@ class ResourceManager
*/
void searchAndAddArchives(const std::string &path,
const std::string &ext,
- const bool append);
+ const bool append) const;
/**
* Searches for zip files and remove them from the search path.
*/
void searchAndRemoveArchives(const std::string &path,
- const std::string &ext);
+ const std::string &ext) const;
/**
* Creates a directory in the write path
@@ -142,7 +142,8 @@ class ResourceManager
* @return A valid resource or <code>NULL</code> if the resource could
* not be generated.
*/
- Resource *get(const std::string &idPath, const generator fun, void *const data);
+ Resource *get(const std::string &idPath, const generator fun,
+ const void *const data);
Resource *getFromCache(const std::string &idPath);
@@ -255,7 +256,7 @@ class ResourceManager
*/
SDL_Surface *loadSDLSurface(const std::string &filename) const;
- void scheduleDelete(SDL_Surface* surface);
+ void scheduleDelete(SDL_Surface *const surface);
void clearScheduled();
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index 216d39390..9a1822e32 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -210,7 +210,7 @@ SDL_Surface* SDLImageHelper::SDLDuplicateSurface(SDL_Surface *const tmpImage)
return SDL_ConvertSurface(tmpImage, tmpImage->format, SDL_SWSURFACE);
}
-Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage)
+Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) const
{
if (!tmpImage)
return nullptr;
diff --git a/src/resources/sdlimagehelper.h b/src/resources/sdlimagehelper.h
index 995b0967e..183627435 100644
--- a/src/resources/sdlimagehelper.h
+++ b/src/resources/sdlimagehelper.h
@@ -78,7 +78,7 @@ class SDLImageHelper : public ImageHelper
protected:
/** SDL_Surface to SDL_Surface Image loader */
- Image *_SDLload(SDL_Surface *tmpImage);
+ Image *_SDLload(SDL_Surface *tmpImage) const;
static bool mEnableAlphaCache;
};
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index b55253c05..f54a332a7 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -250,7 +250,7 @@ void SpriteDef::loadAction(const XmlNodePtr node, const int variant_offset)
void SpriteDef::loadAnimation(const XmlNodePtr animationNode,
Action *const action, ImageSet *const imageSet,
- const int variant_offset)
+ const int variant_offset) const
{
if (!action || !imageSet)
return;
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 565c3a95a..86f2d7f12 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -172,7 +172,7 @@ class SpriteDef : public Resource
*/
void loadAnimation(const XmlNodePtr animationNode,
Action *const action, ImageSet *const imageSet,
- const int variant_offset);
+ const int variant_offset) const;
/**
* Include another sprite into this one.
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 3a5cd05b7..d89ad62eb 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -55,7 +55,7 @@ static std::string wallpaperFile;
// Search for the wallpaper path values sequentially..
static void initDefaultWallpaperPaths()
{
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
// Init the path
wallpaperPath = branding.getStringValue("wallpapersPath");
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index 4832a780a..6111d3a9b 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -142,7 +142,7 @@ void SpellManager::invoke(const int spellId)
>= static_cast<signed>(spell->getSchoolLvl())
&& PlayerInfo::getAttribute(PlayerInfo::MP) >= spell->getMana()))
{
- Being *const target = player_node->getTarget();
+ const Being *const target = player_node->getTarget();
if (spell->getTargetType() == NOTARGET)
{
invokeSpell(spell);
@@ -169,7 +169,7 @@ void SpellManager::invokeSpell(const TextCommand *const spell) const
}
void SpellManager::invokeSpell(const TextCommand *const spell,
- Being *const target) const
+ const Being *const target) const
{
if (!chatWindow || !spell || !target)
return;
@@ -361,7 +361,7 @@ std::string SpellManager::autoComplete(std::string partName)
while (i != i_end)
{
- TextCommand *const cmd = *i;
+ const TextCommand *const cmd = *i;
std::string line = cmd->getCommand();
if (line != "")
diff --git a/src/spellmanager.h b/src/spellmanager.h
index ebda6ec40..e6f3aae7b 100644
--- a/src/spellmanager.h
+++ b/src/spellmanager.h
@@ -64,7 +64,7 @@ class SpellManager
void fillSpells();
void invokeSpell(const TextCommand *const spell,
- Being *const target) const;
+ const Being *const target) const;
void invokeSpell(const TextCommand *const spell) const;
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index bb0112978..1bd8ebef8 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -84,7 +84,8 @@ void TextManager::place(const Text *const textObj, const Text *const omit,
bool occupied[TEST]; // is some other text obscuring this line?
std::memset(&occupied, 0, sizeof(occupied)); // set all to false
const int wantedTop = (TEST - h) / 2; // Entry in occupied at top of text
- const int occupiedTop = y - wantedTop; // Line in map representing to of occupied
+ const int occupiedTop = y - wantedTop; // Line in map representing
+ // to of occupied
int cnt = 0;
for (TextList::const_iterator ptr = mTextList.begin(),
diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp
index 95ba7db82..bc1a571e2 100644
--- a/src/utils/physfsrwops.cpp
+++ b/src/utils/physfsrwops.cpp
@@ -128,7 +128,7 @@ static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
static int physfsrwops_close(SDL_RWops *rw)
{
- PHYSFS_file *handle = static_cast<PHYSFS_file*>(rw->hidden.unknown.data1);
+ PHYSFS_file *const handle = static_cast<PHYSFS_file*>(rw->hidden.unknown.data1);
if (!PHYSFS_close(handle))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp
index 57d9b1604..b7c9a55ec 100644
--- a/src/utils/translation/poparser.cpp
+++ b/src/utils/translation/poparser.cpp
@@ -215,7 +215,7 @@ PoDict *PoParser::getEmptyDict()
bool PoParser::checkLang(std::string lang) const
{
// check is po file exists
- ResourceManager *const resman = ResourceManager::getInstance();
+ const ResourceManager *const resman = ResourceManager::getInstance();
return resman->exists(getFileName(lang));
}