summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popupmenu.cpp7
-rw-r--r--src/gui/popupmenu.h2
-rw-r--r--src/gui/setup_input.cpp2
-rw-r--r--src/gui/widgets/progressbar.cpp25
4 files changed, 15 insertions, 21 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index e2009ee28..eb57dd845 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -1806,8 +1806,6 @@ void PopupMenu::showItemPopup(int x, int y, Item *item)
void PopupMenu::showDropPopup(int x, int y, Item *item)
{
mItem = item;
- mItemId = item->getId();
- mItemColor = item->getColor();
mX = x;
mY = y;
mNick = "";
@@ -1815,6 +1813,9 @@ void PopupMenu::showDropPopup(int x, int y, Item *item)
if (item)
{
+ mItemId = item->getId();
+ mItemColor = item->getColor();
+
if (item->isEquipment())
{
if (item->isEquipped())
@@ -2151,7 +2152,7 @@ void PopupMenu::addBuySellDefault()
}
}
-void PopupMenu::addParty(const std::string partyName)
+void PopupMenu::addParty(const std::string &partyName)
{
if (player_node->isInParty())
{
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index c1675319a..b5d0e956c 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -166,7 +166,7 @@ class PopupMenu : public Popup, public LinkHandler
void addBuySell(const Being *being);
- void addParty(const std::string partyName);
+ void addParty(const std::string &partyName);
void addBuySellDefault();
diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp
index 6dc8c2528..144396314 100644
--- a/src/gui/setup_input.cpp
+++ b/src/gui/setup_input.cpp
@@ -279,7 +279,7 @@ void Setup_Input::action(const gcn::ActionEvent &event)
refreshKeys();
}
}
- else if (!id.find("tabs_"))
+ else if (strStartWith(id, "tabs_"))
{
int k = 0;
std::string str = "tabs_";
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 8b2beb8d5..4be421db4 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -211,24 +211,19 @@ void ProgressBar::render(Graphics *graphics, const gcn::Rectangle &area,
if (*redraw || graphics->getRedraw())
{
*redraw = false;
- static_cast<Graphics*>(graphics)->calcWindow(vert,
- area.x, area.y, area.width, area.height, mBorder);
+ graphics->calcWindow(vert, area.x, area.y,
+ area.width, area.height, mBorder);
}
- static_cast<Graphics*>(graphics)->drawImageRect2(vert, mBorder);
-
-// graphics->drawImageRect(area.x, area.y, area.width, area.height, mBorder);
-// graphics->drawImageRect(area, mBorder);
+ graphics->drawImageRect2(vert, mBorder);
// The bar
if (progress > 0)
{
graphics->setColor(color);
- graphics->fillRectangle(gcn::Rectangle(static_cast<int>(area.x + 4),
- static_cast<int>(area.y + 4),
- static_cast<int>(static_cast<float>(progress)
- * static_cast<float>(area.width - 8)),
- static_cast<int>(area.height - 8)));
+ graphics->fillRectangle(gcn::Rectangle(area.x + 4, area.y + 4,
+ static_cast<int>(progress * static_cast<float>(area.width - 8)),
+ area.height - 8));
}
// The label
@@ -260,11 +255,9 @@ void ProgressBar::render(Graphics *graphics, const gcn::Rectangle &area,
if (progress > 0)
{
graphics->setColor(color);
- graphics->fillRectangle(gcn::Rectangle(static_cast<int>(area.x + 4),
- static_cast<int>(area.y + 4),
- static_cast<int>(static_cast<float>(progress)
- * static_cast<float>(area.width - 8)),
- static_cast<int>(area.height - 8)));
+ graphics->fillRectangle(gcn::Rectangle(area.x + 4, area.y + 4,
+ static_cast<int>(progress * static_cast<float>(area.width - 8)),
+ area.height - 8));
}
// The label