summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-05 15:55:55 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-05 15:55:55 +0300
commitd1bb1b375d657f0821ccfebf18fa1c3873314690 (patch)
treeeb83bbf7242b2c367c4df19113f37f6c6ab9faa2 /src/gui
parent9f87b4c92e3a4d524250dbbb376cd0f59b7d995e (diff)
downloadmanaplus-d1bb1b375d657f0821ccfebf18fa1c3873314690.tar.gz
manaplus-d1bb1b375d657f0821ccfebf18fa1c3873314690.tar.bz2
manaplus-d1bb1b375d657f0821ccfebf18fa1c3873314690.tar.xz
manaplus-d1bb1b375d657f0821ccfebf18fa1c3873314690.zip
Fix useless variables initialisations.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/inventorywindow.cpp2
-rw-r--r--src/gui/npcdialog.cpp4
-rw-r--r--src/gui/socialwindow.cpp3
-rw-r--r--src/gui/viewport.cpp2
-rw-r--r--src/gui/widgets/guitable.cpp5
-rw-r--r--src/gui/windowmenu.cpp2
6 files changed, 7 insertions, 11 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index a5849315b..67faedbad 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -220,7 +220,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
instances.push_back(this);
- if (inventory->isMainInventory())
+ if (inventory && inventory->isMainInventory())
{
updateDropButton();
}
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 85228c19a..36eb0528f 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -278,7 +278,6 @@ void NpcDialog::action(const gcn::ActionEvent &event)
if (mInputState == NPC_INPUT_LIST)
{
- unsigned char choice = 0;
const int selectedIndex = mItemList->getSelected();
if (selectedIndex >= static_cast<int>(mItems.size())
@@ -287,7 +286,8 @@ void NpcDialog::action(const gcn::ActionEvent &event)
{
return;
}
- choice = static_cast<unsigned char>(selectedIndex + 1);
+ unsigned char choice = static_cast<unsigned char>(
+ selectedIndex + 1);
printText = mItems[selectedIndex];
Net::getNpcHandler()->listInput(mNpcId, choice);
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 2db0efb85..403e2c78c 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -1091,8 +1091,7 @@ public:
for (StringVectCIter it = players->begin(), it_end = players->end();
it != it_end; ++ it)
{
- Avatar *ava = nullptr;
- ava = new Avatar(*it);
+ Avatar *ava = new Avatar(*it);
if (actorSpriteManager->findBeingByName(*it, Being::PLAYER)
|| players2.find(*it) != players2.end())
{
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index f521fde8c..34c10f891 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -302,7 +302,7 @@ void Viewport::_followMouse()
void Viewport::_drawDebugPath(Graphics *const graphics)
{
- if (!player_node || !userPalette || !actorSpriteManager)
+ if (!player_node || !userPalette || !actorSpriteManager || !mMap)
return;
// Get the current mouse position
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 0101ed974..4ffe8221f 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -145,7 +145,6 @@ void GuiTable::recomputeDimensions()
const int rows_nr = mModel->getRows();
const int columns_nr = mModel->getColumns();
int width = 0;
- int height = 0;
if (mSelectedRow >= rows_nr)
mSelectedRow = rows_nr - 1;
@@ -156,10 +155,8 @@ void GuiTable::recomputeDimensions()
for (int i = 0; i < columns_nr; i++)
width += getColumnWidth(i);
- height = getRowHeight() * rows_nr;
-
setWidth(width);
- setHeight(height);
+ setHeight(getRowHeight() * rows_nr);
}
void GuiTable::setSelected(int row, int column)
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 5a81f73be..18a53b93d 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -369,7 +369,7 @@ void WindowMenu::saveButtons()
it != it_end; ++it)
{
const Button *const btn = dynamic_cast<const Button *const>(*it);
- if (!btn->isVisible())
+ if (btn && !btn->isVisible())
{
config.setValue("windowmenu" + toString(i),
btn->getActionEventId());