summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actorspritemanager.cpp3
-rw-r--r--src/configuration.h1
-rw-r--r--src/graphicsmanager.cpp3
-rw-r--r--src/graphicsmanager.h2
-rw-r--r--src/gui/itempopup.cpp5
-rw-r--r--src/gui/shopwindow.cpp4
-rw-r--r--src/gui/socialwindow.cpp2
-rw-r--r--src/gui/tradewindow.cpp4
-rw-r--r--src/gui/tradewindow.h4
-rw-r--r--src/gui/viewport.cpp6
-rw-r--r--src/map.cpp3
-rw-r--r--src/map.h2
-rw-r--r--src/net/download.cpp2
-rw-r--r--src/net/ea/gamehandler.cpp2
-rw-r--r--src/net/ea/gamehandler.h2
-rw-r--r--src/playerrelations.cpp3
-rw-r--r--src/utils/copynpaste.cpp7
17 files changed, 21 insertions, 34 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 73d522527..82ee868cc 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -1442,10 +1442,9 @@ void ActorSpriteManager::parseLevels(std::string levels) const
{
levels += ", ";
size_t f = 0;
- size_t pos = 0;
const std::string brkEnd = "), ";
+ size_t pos = levels.find(brkEnd, f);
- pos = levels.find(brkEnd, f);
while (pos != std::string::npos)
{
std::string part = levels.substr(f, pos - f);
diff --git a/src/configuration.h b/src/configuration.h
index e2e18375c..96f45c2b7 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -159,7 +159,6 @@ class ConfigurationObject
}
delete nextobj;
- nextobj = nullptr;
}
/**
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 66502434d..2d2740023 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -337,10 +337,9 @@ void GraphicsManager::updateTextureFormat()
|| supportExtension("3DFX_texture_compression_FXT1"))
{
GLint num;
- GLint *formats = nullptr;
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &num);
logger->log("support %d compressed formats", num);
- formats = new GLint[num > 10 ? num : 10];
+ GLint *formats = new GLint[num > 10 ? num : 10];
glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
for (int f = 0; f < num; f ++)
{
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index 0ee79cb25..0afdada1e 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -73,7 +73,7 @@ class GraphicsManager
Graphics *createGraphics();
- int getMaxVertices()
+ int getMaxVertices() const
{ return mMaxVertices; }
private:
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index feb9a050d..4b0501def 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -89,12 +89,9 @@ ItemPopup::~ItemPopup()
{
if (mIcon)
{
- Image *image = mIcon->getImage();
+ Image *const image = mIcon->getImage();
if (image)
- {
image->decRef();
- image = nullptr;
- }
}
}
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index 95ee92f9f..386652a93 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -693,9 +693,7 @@ void ShopWindow::processRequest(std::string nick, std::string data,
if (!inv)
return;
- size_t idx = 0;
-
- idx = data.find(" ");
+ size_t idx = data.find(" ");
if (idx == std::string::npos)
return;
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index bba269144..c8f20edd2 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -1111,7 +1111,7 @@ public:
for (StringVectCIter it = players->begin(), it_end = players->end();
it != it_end; ++ it)
{
- Avatar *ava = new Avatar(*it);
+ Avatar *const ava = new Avatar(*it);
if (actorSpriteManager->findBeingByName(*it, Being::PLAYER)
|| players2.find(*it) != players2.end())
{
diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp
index e2db704f6..b696bad39 100644
--- a/src/gui/tradewindow.cpp
+++ b/src/gui/tradewindow.cpp
@@ -407,7 +407,7 @@ void TradeWindow::clear()
static_cast<int>(Theme::LABEL)));
}
-void TradeWindow::addAutoItem(const std::string nick, Item* const item,
+void TradeWindow::addAutoItem(const std::string &nick, Item* const item,
const int amount)
{
mAutoAddToNick = nick;
@@ -415,7 +415,7 @@ void TradeWindow::addAutoItem(const std::string nick, Item* const item,
mAutoAddAmount = amount;
}
-void TradeWindow::addAutoMoney(const std::string nick, const int money)
+void TradeWindow::addAutoMoney(const std::string &nick, const int money)
{
mAutoAddToNick = nick;
mAutoMoney = money;
diff --git a/src/gui/tradewindow.h b/src/gui/tradewindow.h
index 892255fb6..3b840f045 100644
--- a/src/gui/tradewindow.h
+++ b/src/gui/tradewindow.h
@@ -132,10 +132,10 @@ class TradeWindow : public Window,
/**
* Add item what will be added to trade.
*/
- void addAutoItem(const std::string nick, Item *const item,
+ void addAutoItem(const std::string &nick, Item *const item,
const int amount);
- void addAutoMoney(const std::string nick, const int money);
+ void addAutoMoney(const std::string &nick, const int money);
void initTrade(std::string nick);
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index b9abb4952..f30ebaecd 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -897,8 +897,8 @@ void Viewport::moveCameraToActor(const int actorId, const int x, const int y)
const Actor *const actor = actorSpriteManager->findBeing(actorId);
if (!actor)
return;
- const Vector actorPos = actor->getPosition();
- const Vector playerPos = player_node->getPosition();
+ const Vector &actorPos = actor->getPosition();
+ const Vector &playerPos = player_node->getPosition();
mCameraMode = 1;
mCameraRelativeX = actorPos.x - playerPos.x + x;
mCameraRelativeY = actorPos.y - playerPos.y + y;
@@ -909,7 +909,7 @@ void Viewport::moveCameraToPosition(const int x, const int y)
if (!player_node)
return;
- const Vector playerPos = player_node->getPosition();
+ const Vector &playerPos = player_node->getPosition();
mCameraMode = 1;
mCameraRelativeX = x - playerPos.x;
diff --git a/src/map.cpp b/src/map.cpp
index 6d3d96fd9..29d9a6821 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -22,7 +22,6 @@
#include "map.h"
-#include "actorspritemanager.h"
#include "client.h"
#include "configuration.h"
@@ -706,7 +705,7 @@ Actors::iterator Map::addActor(Actor *const actor)
return mActors.begin();
}
-void Map::removeActor(Actors::iterator iterator)
+void Map::removeActor(const Actors::iterator iterator)
{
mActors.erase(iterator);
// mSpritesUpdated = true;
diff --git a/src/map.h b/src/map.h
index 3485f6c58..66cf8b707 100644
--- a/src/map.h
+++ b/src/map.h
@@ -404,7 +404,7 @@ class Map : public Properties, public ConfigListener
/**
* Removes an actor from the map.
*/
- void removeActor(Actors::iterator iterator);
+ void removeActor(const Actors::iterator iterator);
private:
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 5d35e1ace..9c9a777fa 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -206,7 +206,6 @@ int Download::downloadThread(void *ptr)
while (attempts < 3 && !complete && !d->mOptions.cancel)
{
- FILE *file = nullptr;
d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_STARTING, 0, 0);
@@ -221,6 +220,7 @@ int Download::downloadThread(void *ptr)
if (d->mCurl && !d->mOptions.cancel)
{
+ FILE *file = nullptr;
logger->log("Downloading: %s", d->mUrl.c_str());
curl_easy_setopt(d->mCurl, CURLOPT_FOLLOWLOCATION, 1);
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp
index 1cb105204..ededed886 100644
--- a/src/net/ea/gamehandler.cpp
+++ b/src/net/ea/gamehandler.cpp
@@ -62,7 +62,7 @@ void GameHandler::who()
{
}
-void GameHandler::setMap(const std::string map)
+void GameHandler::setMap(const std::string &map)
{
mMap = map.substr(0, map.rfind("."));
}
diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h
index de7a1623d..ba68c710e 100644
--- a/src/net/ea/gamehandler.h
+++ b/src/net/ea/gamehandler.h
@@ -45,7 +45,7 @@ class GameHandler : public Net::GameHandler, public Listener
virtual bool removeDeadBeings() const
{ return true; }
- virtual void setMap(const std::string map);
+ virtual void setMap(const std::string &map);
virtual bool canUseMagicBar() const
{ return true; }
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 549c3ca2d..5f696413b 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -152,7 +152,6 @@ void PlayerRelationsManager::clear()
removePlayer(*it);
}
delete names;
- names = nullptr;
}
static const char *const PERSIST_IGNORE_LIST = "persistent-player-list";
@@ -585,7 +584,7 @@ bool PlayerRelationsManager::isGoodName(Being *const being)
if (size < 3 || mRelations[name])
return true;
- bool status = checkName(name);
+ const bool status = checkName(name);
being->setGoodStatus(status ? 1 : 0);
return status;
}
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index 3c7a5b3b7..2b7acc0e1 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -142,7 +142,6 @@ bool getDataFromPasteboard(PasteboardRef inPasteboard,
char* flavorText /* out */,
const int bufSize)
{
- OSStatus err = noErr;
PasteboardSyncFlags syncFlags;
ItemCount itemCount;
@@ -151,7 +150,7 @@ bool getDataFromPasteboard(PasteboardRef inPasteboard,
//require_action( syncFlags & kPasteboardModified, PasteboardOutOfSync,
// err = badPasteboardSyncErr );
- err = PasteboardGetItemCount(inPasteboard, &itemCount);
+ OSStatus err = PasteboardGetItemCount(inPasteboard, &itemCount);
require_noerr(err, CantGetPasteboardItemCount);
for (UInt32 itemIndex = 1; itemIndex <= itemCount; itemIndex ++)
@@ -239,10 +238,8 @@ CantGetPasteboardItemCount:
bool getClipBoard(char* text /* out */, const int bufSize)
{
- OSStatus err = noErr;
-
PasteboardRef theClipboard;
- err = PasteboardCreate(kPasteboardClipboard, &theClipboard);
+ OSStatus err = PasteboardCreate(kPasteboardClipboard, &theClipboard);
require_noerr(err, PasteboardCreateFailed);
if (!getDataFromPasteboard(theClipboard, text, bufSize))