diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-27 21:41:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-27 21:41:20 +0300 |
commit | 964ffbb9b6ed5246b14a7d0c0d065f7d38af0912 (patch) | |
tree | edef1b3f31183402e2d0f86ee48c9734c2a03c7e /src/gui | |
parent | 41ac086fcd38fd472b579a495a8e8e7685ae4722 (diff) | |
download | plus-964ffbb9b6ed5246b14a7d0c0d065f7d38af0912.tar.gz plus-964ffbb9b6ed5246b14a7d0c0d065f7d38af0912.tar.bz2 plus-964ffbb9b6ed5246b14a7d0c0d065f7d38af0912.tar.xz plus-964ffbb9b6ed5246b14a7d0c0d065f7d38af0912.zip |
Fix some warnings and improve code from gcc 4.6 compilation.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/botcheckerwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/chat.cpp | 2 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 8 | ||||
-rw-r--r-- | src/gui/killstats.cpp | 2 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 4 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 3 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 5 | ||||
-rw-r--r-- | src/gui/setup_video.h | 2 | ||||
-rw-r--r-- | src/gui/theme.cpp | 3 | ||||
-rw-r--r-- | src/gui/theme.h | 1 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 5 | ||||
-rw-r--r-- | src/gui/whoisonline.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/shopitems.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/shopitems.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/table.cpp | 39 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 2 |
21 files changed, 69 insertions, 38 deletions
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index bd721e8aa..c2cfab2f6 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -104,7 +104,6 @@ public: && botCheckerWindow->mEnabled) { std::set<ActorSprite*> beings = actorSpriteManager->getAll(); - ActorSprites::iterator i = beings.begin(); for (ActorSprites::const_iterator i = beings.begin(); i != beings.end(); ++i) { @@ -391,7 +390,6 @@ void BotCheckerWindow::reset() if (actorSpriteManager) { std::set<ActorSprite*> beings = actorSpriteManager->getAll(); - ActorSprites::iterator i = beings.begin(); for (ActorSprites::const_iterator i = beings.begin(); i != beings.end(); ++i) { diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index bff000ef3..54638f793 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -199,7 +199,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) const std::string &eventId = event.getId(); - if (selected != -1) + if (selected >= 0) { if (eventId == "use") { diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 88dbd1b0a..e50310409 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -689,7 +689,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) mChatInput->isVisible()) { ChatTab *tab = getFocused(); - if (tab && tab->getRows().size() > 0) + if (tab && (unsigned)tab->getRows().size() > 0) { if (!mChatHistoryIndex) { diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 493b5041a..e09d0ce0a 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -116,8 +116,8 @@ void ItemPopup::setItem(const Item *item, bool showImage) ii.getName().c_str(), item->getRefine(), ii.getId())); } mItemName->adjustSize(); - int minWidth = mItemName->getWidth() + 8; - if (getWidth() < minWidth) + unsigned minWidth = mItemName->getWidth() + 8; + if ((unsigned)getWidth() < minWidth) setWidth(minWidth); } } @@ -256,6 +256,10 @@ gcn::Color ItemPopup::getColor(ItemType type) return Theme::getThemeColor(Theme::FEET); case ITEM_EQUIPMENT_AMMO: return Theme::getThemeColor(Theme::AMMO); + case ITEM_EQUIPMENT_CHARM: + return Theme::getThemeColor(Theme::CHARM); + case ITEM_SPRITE_RACE: + case ITEM_SPRITE_HAIR: default: return Theme::getThemeColor(Theme::UNKNOWN_ITEM); } diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 9bbbc8549..f01dd01c7 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -193,7 +193,7 @@ void KillStats::gainXp(int xp) mLine2->setCaption("Exp: " + toString(PlayerInfo::getAttribute(EXP)) + "/" + toString(xpNextLevel) + " Left: " + toString(xpNextLevel - PlayerInfo::getAttribute(EXP))); - if (AvgExp >= 0.001 && AvgExp <= 0.001) + if (AvgExp >= 0.001f && AvgExp <= 0.001f) { mLine3->setCaption("1% = " + toString(xpNextLevel / 100) + " exp, Avg Mob for 1%: ?"); diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index e5371eaf3..93f84bcf7 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -275,6 +275,10 @@ void Minimap::draw(gcn::Graphics *graphics) type = UserPalette::NPC; break; + case ActorSprite::UNKNOWN: + case ActorSprite::PLAYER: + case ActorSprite::FLOOR_ITEM: + case ActorSprite::PORTAL: default: continue; } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 183b006d5..4372897cd 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -250,6 +250,9 @@ void PopupMenu::showPopup(int x, int y, Being *being) } break; + case ActorSprite::UNKNOWN: + case ActorSprite::FLOOR_ITEM: + case ActorSprite::PORTAL: default: /* Other beings aren't interesting... */ return; diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index b9f0bc6f5..38124f5c0 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -66,6 +66,7 @@ static std::string serverTypeToString(ServerInfo::Type type) case ServerInfo::MANASERV: return "ManaServ"; default: + case ServerInfo::UNKNOWN: return ""; } } @@ -75,6 +76,7 @@ static unsigned short defaultPortForServerType(ServerInfo::Type type) switch (type) { default: + case ServerInfo::UNKNOWN: case ServerInfo::TMWATHENA: return 6901; case ServerInfo::MANASERV: @@ -490,8 +492,7 @@ void ServerDialog::logic() else if (mDownloadStatus == DOWNLOADING_IN_PROGRESS) { mDescription->setCaption(strprintf(_("Downloading server list..." - "%2.2f%%"), - mDownloadProgress * 100)); + "%2.2f%%"), mDownloadProgress * 100)); } else if (mDownloadStatus == DOWNLOADING_IDLE) { diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index a49895b53..1eba02b4f 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -64,7 +64,7 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, bool mNPCLogEnabled; bool mPickupChatEnabled; bool mPickupParticleEnabled; - double mOpacity; + float mOpacity; int mFps; int mAltFps; bool mHideShieldSprite; diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 2f61eecb9..8aab63728 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -632,7 +632,8 @@ static int readColorType(const std::string &type) "ARMS", "AMMO", "SERVER_VERSION_NOT_SUPPORTED", - "WARNING" + "WARNING", + "CHARM" }; if (type.empty()) diff --git a/src/gui/theme.h b/src/gui/theme.h index 0e5559d8c..e483bff69 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -182,6 +182,7 @@ class Theme : public Palette, public ConfigListener AMMO, SERVER_VERSION_NOT_SUPPORTED, WARNING, + CHARM, THEME_COLORS_END }; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 92bd0d80b..4dd5431ee 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -705,6 +705,11 @@ void Viewport::mouseMoved(gcn::MouseEvent &event _UNUSED_) case ActorSprite::MONSTER: gui->setCursorType(Gui::CURSOR_FIGHT); break; + + case ActorSprite::UNKNOWN: + case ActorSprite::PLAYER: + case ActorSprite::FLOOR_ITEM: + case ActorSprite::PORTAL: default: gui->setCursorType(Gui::CURSOR_POINTER); break; diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index c4d9e92a3..9a72bb7fd 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -484,6 +484,7 @@ void WhoIsOnline::logic() chatWindow->updateOnline(mOnlinePlayers); } break; + case UPDATE_COMPLETE: default: break; } diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 8546cbd7e..bc5583148 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -178,7 +178,7 @@ void BrowserBox::addRow(const std::string &row, bool atTop) unsigned int nextChar; const char *hyphen = "~"; int hyphenWidth = font->getWidth(hyphen); - int x = 0; + unsigned x = 0; for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); ++i) { @@ -197,7 +197,7 @@ void BrowserBox::addRow(const std::string &row, bool atTop) if (nextSpacePos <= 0) nextSpacePos = static_cast<int>(row.size()) - 1; - int nextWordWidth = font->getWidth( + unsigned nextWordWidth = font->getWidth( row.substr(nextChar, (nextSpacePos - nextChar))); @@ -335,7 +335,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) int BrowserBox::calcHeight() { - int x = 0, y = 0; + unsigned x = 0, y = 0; int wrappedLines = 0; int link = 0; gcn::Font *font = getFont(); @@ -360,7 +360,7 @@ int BrowserBox::calcHeight() if (row.find("---", 0) == 0) { const int dashWidth = fontWidthMinus; - for (x = 0; x < getWidth(); x++) + for (x = 0; x < (unsigned)getWidth(); x++) { mLineParts.push_back(LinePart(x, y, selColor, "-")); x += dashWidth - 2; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 40bde104e..2c8db7e85 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -162,6 +162,7 @@ void ChatTab::chatLog(std::string line, Own own, lineColor = "##Y"; break; case BY_OTHER: + case BY_UNKNOWN: tmp.nick += ": "; lineColor = "##C"; break; diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index e0a0da87a..c9f1269aa 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -375,6 +375,8 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event) case SEL_DRAGGING: mSelectionStatus = SEL_SELECTED; break; + case SEL_NONE: + case SEL_SELECTED: default: return; }; diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp index 6cd0ef39d..764f22a57 100644 --- a/src/gui/widgets/shopitems.cpp +++ b/src/gui/widgets/shopitems.cpp @@ -105,12 +105,12 @@ void ShopItems::clear() mShopItems.clear(); } -ShopItem *ShopItems::findItem(int id, unsigned char color) +ShopItem *ShopItems::findItem(int id, unsigned char color) const { ShopItem *item; - std::vector<ShopItem*>::iterator it = mShopItems.begin(); - std::vector<ShopItem*>::iterator e = mShopItems.end(); + std::vector<ShopItem*>::const_iterator it = mShopItems.begin(); + std::vector<ShopItem*>::const_iterator e = mShopItems.end(); while (it != e) { item = *(it); diff --git a/src/gui/widgets/shopitems.h b/src/gui/widgets/shopitems.h index 2b2dcc5eb..cc444fe85 100644 --- a/src/gui/widgets/shopitems.h +++ b/src/gui/widgets/shopitems.h @@ -110,7 +110,7 @@ class ShopItems : public gcn::ListModel * * @return the item found or 0 */ - ShopItem *findItem(int id, unsigned char color); + ShopItem *findItem(int id, unsigned char color) const; /** The list of items in the shop. */ std::vector<ShopItem*> mShopItems; diff --git a/src/gui/widgets/table.cpp b/src/gui/widgets/table.cpp index 6011e4ceb..00f41a760 100644 --- a/src/gui/widgets/table.cpp +++ b/src/gui/widgets/table.cpp @@ -301,27 +301,31 @@ void GuiTable::draw(gcn::Graphics* graphics) if (first_row < 0) first_row = 0; - int rows_nr = 1 + (getHeight() / getRowHeight()); // May overestimate + unsigned rows_nr = 1 + (getHeight() / getRowHeight()); // May overestimate // by one. - int max_rows_nr = mModel->getRows() - first_row; // clip if neccessary: + unsigned max_rows_nr; + if (mModel->getRows() < first_row) + max_rows_nr = 0; + else + max_rows_nr = mModel->getRows() - first_row; // clip if neccessary: if (max_rows_nr < rows_nr) rows_nr = max_rows_nr; // Now determine the first and last column // Take the easy way out; these are usually bounded and all visible. - int first_column = 0; - int last_column1 = mModel->getColumns(); + unsigned first_column = 0; + unsigned last_column1 = mModel->getColumns(); // Set up everything for drawing int height = getRowHeight(); int y_offset = first_row * height; - for (int r = first_row; r < first_row + rows_nr; ++r) + for (unsigned r = first_row; r < first_row + rows_nr; ++r) { int x_offset = 0; - for (int c = first_column; c + 1 <= last_column1; ++c) + for (unsigned c = first_column; c + 1 <= last_column1; ++c) { gcn::Widget *widget = mModel->getElementAt(r, c); int width = getColumnWidth(c); @@ -340,18 +344,21 @@ void GuiTable::draw(gcn::Graphics* graphics) graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT, static_cast<int>(mAlpha * 255.0f))); - if (mLinewiseMode && r == mSelectedRow && c == 0) - { - graphics->fillRectangle(gcn::Rectangle(0, y_offset, - getWidth(), height)); - } - else if (!mLinewiseMode && - c == mSelectedColumn && r == mSelectedRow) + if (mSelectedRow > 0) { - graphics->fillRectangle(gcn::Rectangle(x_offset, y_offset, - width, height)); + if (mLinewiseMode && r == (unsigned)mSelectedRow && c == 0) + { + graphics->fillRectangle(gcn::Rectangle(0, y_offset, + getWidth(), height)); + } + else if (!mLinewiseMode && mSelectedColumn > 0 + && c == (unsigned)mSelectedColumn + && r == (unsigned)mSelectedRow) + { + graphics->fillRectangle(gcn::Rectangle(x_offset, y_offset, + width, height)); + } } - graphics->pushClipArea(bounds); widget->draw(graphics); graphics->popClipArea(); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 8c33b4787..1b008a087 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -768,14 +768,17 @@ void Window::resetToDefaultSize() int Window::getResizeHandles(gcn::MouseEvent &event) { + if (event.getX() < 0 || event.getY() < 0) + return 0; + int resizeHandles = 0; - const int y = event.getY(); + const unsigned y = event.getY(); if (mGrip && (y > static_cast<int>(mTitleBarHeight) || (y < static_cast<int>(getPadding()) && mTitleBarHeight > getPadding()))) { - const int x = event.getX(); + const unsigned x = event.getX(); if (!getWindowArea().isPointInRect(x, y) && event.getSource() == this) { diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 6f856fc62..f455f1238 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -439,7 +439,7 @@ class Window : public gcn::Window, gcn::WidgetListener * border width, and determines mostly the size of the corner area * where two borders are moved at the same time. */ - static const int resizeBorderWidth = 10; + static const unsigned resizeBorderWidth = 10; GraphicsVertexes *mVertexes; bool mRedraw; }; |