summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/socialwindow.cpp9
-rw-r--r--src/gui/statuspopup.cpp39
-rw-r--r--src/gui/statuspopup.h5
-rw-r--r--src/gui/widgets/browserbox.cpp2
-rw-r--r--src/gui/widgets/guitable.cpp2
-rw-r--r--src/gui/widgets/shopitems.cpp4
-rw-r--r--src/gui/widgets/shoplistbox.cpp4
-rw-r--r--src/gui/widgets/shoplistbox.h2
8 files changed, 23 insertions, 44 deletions
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 6c74f4397..653140e3f 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -766,16 +766,15 @@ public:
if (!map)
return;
- Avatar *ava = nullptr;
std::vector<Avatar*>::const_iterator i = avatars->begin();
const std::vector<Avatar*>::const_iterator i_end = avatars->end();
while (i != i_end)
{
- ava = (*i);
+ Avatar *const ava = *i;
if (!ava)
break;
- const MapItem *const item = map->findPortalXY(
+ const MapItem *const item = map->findPortalXY(
ava->getX(), ava->getY());
if (item)
{
@@ -802,14 +801,12 @@ public:
if (!map)
return 01;
- const Avatar *ava = nullptr;
std::vector<Avatar*>::const_iterator i = avatars->begin();
const std::vector<Avatar*>::const_iterator i_end = avatars->end();
unsigned num = 0;
while (i != i_end)
{
- ava = (*i);
-
+ const Avatar *const ava = *i;
if (!ava)
break;
diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp
index e794cea66..f4b06991c 100644
--- a/src/gui/statuspopup.cpp
+++ b/src/gui/statuspopup.cpp
@@ -188,14 +188,7 @@ void StatusPopup::view(const int x, const int y)
requestMoveToTop();
}
-void StatusPopup::setLabelText(Label *const label, const char *const text,
- int const key) const
-{
- label->setCaption(strprintf("%s %s", text,
- inputManager.getKeyValueString(key).c_str()));
-}
-
-void StatusPopup::setLabelText2(Label *const label,
+void StatusPopup::setLabelText(Label *const label,
const std::string &text,
const Input::KeyAction key) const
{
@@ -209,34 +202,34 @@ void StatusPopup::updateLabels()
if (!player_node || !viewport)
return;
- setLabelText2(mMoveType, player_node->getInvertDirectionString(),
+ setLabelText(mMoveType, player_node->getInvertDirectionString(),
Input::KEY_INVERT_DIRECTION);
- setLabelText2(mCrazyMoveType, player_node->getCrazyMoveTypeString(),
+ setLabelText(mCrazyMoveType, player_node->getCrazyMoveTypeString(),
Input::KEY_CHANGE_CRAZY_MOVES_TYPE);
- setLabelText2(mMoveToTargetType, player_node->getMoveToTargetTypeString(),
+ setLabelText(mMoveToTargetType, player_node->getMoveToTargetTypeString(),
Input::KEY_CHANGE_MOVE_TO_TARGET);
- setLabelText2(mFollowMode, player_node->getFollowModeString(),
+ setLabelText(mFollowMode, player_node->getFollowModeString(),
Input::KEY_CHANGE_FOLLOW_MODE);
- setLabelText2(mAttackWeaponType, player_node->getAttackWeaponTypeString(),
+ setLabelText(mAttackWeaponType, player_node->getAttackWeaponTypeString(),
Input::KEY_CHANGE_ATTACK_WEAPON_TYPE);
- setLabelText2(mAttackType, player_node->getAttackTypeString(),
+ setLabelText(mAttackType, player_node->getAttackTypeString(),
Input::KEY_CHANGE_ATTACK_TYPE);
- setLabelText2(mDropCounter, player_node->getQuickDropCounterString(),
+ setLabelText(mDropCounter, player_node->getQuickDropCounterString(),
Input::KEY_SWITCH_QUICK_DROP);
- setLabelText2(mPickUpType, player_node->getPickUpTypeString(),
+ setLabelText(mPickUpType, player_node->getPickUpTypeString(),
Input::KEY_CHANGE_PICKUP_TYPE);
- setLabelText2(mMapType, player_node->getDebugPathString(),
+ setLabelText(mMapType, player_node->getDebugPathString(),
Input::KEY_PATHFIND);
- setLabelText2(mMagicAttackType, player_node->getMagicAttackString(),
+ setLabelText(mMagicAttackType, player_node->getMagicAttackString(),
Input::KEY_SWITCH_MAGIC_ATTACK);
- setLabelText2(mPvpAttackType, player_node->getPvpAttackString(),
+ setLabelText(mPvpAttackType, player_node->getPvpAttackString(),
Input::KEY_SWITCH_PVP_ATTACK);
- setLabelText2(mImitationMode, player_node->getImitationModeString(),
+ setLabelText(mImitationMode, player_node->getImitationModeString(),
Input::KEY_CHANGE_IMITATION_MODE);
- setLabelText2(mAwayMode, player_node->getAwayModeString(),
+ setLabelText(mAwayMode, player_node->getAwayModeString(),
Input::KEY_AWAY);
- setLabelText2(mCameraMode, player_node->getCameraModeString(),
+ setLabelText(mCameraMode, player_node->getCameraModeString(),
Input::KEY_CAMERA);
- setLabelText2(mDisableGameModifiers, player_node->getGameModifiersString(),
+ setLabelText(mDisableGameModifiers, player_node->getGameModifiersString(),
Input::KEY_DISABLE_GAME_MODIFIERS);
}
diff --git a/src/gui/statuspopup.h b/src/gui/statuspopup.h
index d57fe54ba..128345d51 100644
--- a/src/gui/statuspopup.h
+++ b/src/gui/statuspopup.h
@@ -63,10 +63,7 @@ class StatusPopup final : public Popup
private:
void updateLabels();
- void setLabelText(Label *const label, const char *const text,
- const int key) const;
-
- void setLabelText2(Label *const label, const std::string &text,
+ void setLabelText(Label *const label, const std::string &text,
const Input::KeyAction key) const;
Label *mMoveType;
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index bbd31cee7..93c65e356 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -536,7 +536,7 @@ int BrowserBox::calcHeight()
{
const signed char c = row.at(start + 2);
- bool valid;
+ bool valid(false);
const gcn::Color col[2] =
{
getThemeCharColor(c, valid),
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 8b6722a59..e40248121 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -382,7 +382,7 @@ void GuiTable::draw(gcn::Graphics* graphics)
if (mTopWidget)
{
- const gcn::Rectangle bounds = mTopWidget->getDimension();
+ const gcn::Rectangle &bounds = mTopWidget->getDimension();
graphics->pushClipArea(bounds);
mTopWidget->draw(graphics);
graphics->popClipArea();
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp
index f97767064..22049e944 100644
--- a/src/gui/widgets/shopitems.cpp
+++ b/src/gui/widgets/shopitems.cpp
@@ -116,13 +116,11 @@ void ShopItems::clear()
ShopItem *ShopItems::findItem(const int id, const unsigned char color) const
{
- ShopItem *item;
-
std::vector<ShopItem*>::const_iterator it = mShopItems.begin();
const std::vector<ShopItem*>::const_iterator e = mShopItems.end();
while (it != e)
{
- item = *(it);
+ ShopItem *const item = *it;
if (item->getId() == id && item->getColor() == color)
return item;
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index d2868f3d2..45891f202 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -73,10 +73,6 @@ ShopListBox::ShopListBox(const Widget2 *const widget,
mForegroundColor = getThemeColor(Theme::LISTBOX);
}
-void ShopListBox::init()
-{
-}
-
void ShopListBox::setPlayersMoney(const int money)
{
mPlayerMoney = money;
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index 16f54e78a..ad58ea413 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -85,8 +85,6 @@ class ShopListBox final : public ListBox
void mouseExited(gcn::MouseEvent& mouseEvent) override;
private:
- void init();
-
int mPlayerMoney;
/**