From f0ae9007f666580259ca8c120f7aaee58a63f85a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 6 May 2012 18:03:52 +0300 Subject: Fix code style. --- src/gui/popupmenu.cpp | 7 ++++--- src/gui/popupmenu.h | 2 +- src/gui/setup_input.cpp | 2 +- src/gui/widgets/progressbar.cpp | 25 +++++++++---------------- 4 files changed, 15 insertions(+), 21 deletions(-) (limited to 'src/gui') 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)->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)->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(area.x + 4), - static_cast(area.y + 4), - static_cast(static_cast(progress) - * static_cast(area.width - 8)), - static_cast(area.height - 8))); + graphics->fillRectangle(gcn::Rectangle(area.x + 4, area.y + 4, + static_cast(progress * static_cast(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(area.x + 4), - static_cast(area.y + 4), - static_cast(static_cast(progress) - * static_cast(area.width - 8)), - static_cast(area.height - 8))); + graphics->fillRectangle(gcn::Rectangle(area.x + 4, area.y + 4, + static_cast(progress * static_cast(area.width - 8)), + area.height - 8)); } // The label -- cgit v1.2.3-70-g09d2