diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-11 20:03:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-11 20:03:02 +0300 |
commit | 91fa2122a536770924bb2819bec4b79e76393d08 (patch) | |
tree | 93c0e191249b2158cf92a564630a4b16e9ccdcaa /src/gui | |
parent | 1a524dc9468fe532bc060a73ef736a68687aadca (diff) | |
download | plus-91fa2122a536770924bb2819bec4b79e76393d08.tar.gz plus-91fa2122a536770924bb2819bec4b79e76393d08.tar.bz2 plus-91fa2122a536770924bb2819bec4b79e76393d08.tar.xz plus-91fa2122a536770924bb2819bec4b79e76393d08.zip |
Fix code style and small perfomance issues.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/itempopup.cpp | 5 | ||||
-rw-r--r-- | src/gui/shopwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/tradewindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/tradewindow.h | 4 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 6 |
6 files changed, 10 insertions, 15 deletions
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; |