From a2bfd50be766b3303f3e8dead3b42d16c60f6081 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 4 Jul 2011 17:49:59 +0300 Subject: Fix code style and compilation warnings. --- src/gui/setupitem.cpp | 4 ++-- src/gui/widgets/vertcontainer.cpp | 2 +- src/guichan/widget.cpp | 21 +++++++++++---------- src/map.cpp | 27 ++++++++++++++++----------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/gui/setupitem.cpp b/src/gui/setupitem.cpp index e41e9357d..e4f112068 100644 --- a/src/gui/setupitem.cpp +++ b/src/gui/setupitem.cpp @@ -498,10 +498,10 @@ void SetupItemLabel::toWidget() { } -void SetupItemLabel::action(const gcn::ActionEvent &event) +void SetupItemLabel::action(const gcn::ActionEvent &event _UNUSED_) { } -void SetupItemLabel::apply(std::string eventName) +void SetupItemLabel::apply(std::string eventName _UNUSED_) { } diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 9920c7210..3dd258ad3 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -74,7 +74,7 @@ void VertContainer::clear() void VertContainer::widgetResized(const gcn::Event &event _UNUSED_) { for (std::vector::iterator it = mResizableWidgets.begin(); - it != mResizableWidgets.end(); it++) + it != mResizableWidgets.end(); ++ it) { (*it)->setWidth(getWidth()); } diff --git a/src/guichan/widget.cpp b/src/guichan/widget.cpp index 8ec3a8178..6c02384b9 100644 --- a/src/guichan/widget.cpp +++ b/src/guichan/widget.cpp @@ -309,10 +309,10 @@ namespace gcn bool Widget::isVisible() const { - if (getParent() == NULL) + if (!mParent) return mVisible; else - return mVisible && getParent()->isVisible(); + return mVisible && mParent->isVisible(); } void Widget::setBaseColor(const Color& color) @@ -436,7 +436,7 @@ namespace gcn void Widget::getAbsolutePosition(int& x, int& y) const { - if (getParent() == NULL) + if (!mParent) { x = mDimension.x; y = mDimension.y; @@ -446,10 +446,11 @@ namespace gcn int parentX; int parentY; - getParent()->getAbsolutePosition(parentX, parentY); + mParent->getAbsolutePosition(parentX, parentY); - x = parentX + mDimension.x + getParent()->getChildrenArea().x; - y = parentY + mDimension.y + getParent()->getChildrenArea().y; + const Rectangle &rect = mParent->getChildrenArea(); + x = parentX + mDimension.x + rect.x; + y = parentY + mDimension.y + rect.y; } Font* Widget::getFont() const @@ -574,10 +575,10 @@ namespace gcn "the widget to the gui?)."); } - if (getParent() != NULL) + if (mParent) { return (mFocusHandler->getModalFocused() == this) - || getParent()->isModalFocused(); + || mParent->isModalFocused(); } return mFocusHandler->getModalFocused() == this; @@ -591,10 +592,10 @@ namespace gcn "the widget to the gui?)."); } - if (getParent() != NULL) + if (mParent) { return (mFocusHandler->getModalMouseInputFocused() == this) - || getParent()->isModalMouseInputFocused(); + || mParent->isModalMouseInputFocused(); } return mFocusHandler->getModalMouseInputFocused() == this; diff --git a/src/map.cpp b/src/map.cpp index 89ae7006e..e5baeddc9 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -676,15 +676,16 @@ void Map::drawCollision(Graphics *graphics, int scrollX, int scrollY, int width = 0; int x0 = x; -// if (!getWalk(x, y, BLOCKMASK_WALL)) if (mMetaTiles[x + y * mWidth].blockmask & BLOCKMASK_WALL) { width = 32; for (int x2 = x + 1; x < endX; x2 ++) { -// if (getWalk(x2, y, BLOCKMASK_WALL)) - if (!(mMetaTiles[x2 + y * mWidth].blockmask & BLOCKMASK_WALL)) + if (!(mMetaTiles[x2 + y * mWidth].blockmask + & BLOCKMASK_WALL)) + { break; + } width += 32; x ++; } @@ -700,15 +701,17 @@ void Map::drawCollision(Graphics *graphics, int scrollX, int scrollY, } } -// if (x < endX && !getWalk(x, y, BLOCKMASK_AIR)) - if (x < endX && mMetaTiles[x + y * mWidth].blockmask & BLOCKMASK_AIR) + if (x < endX && mMetaTiles[x + y * mWidth].blockmask + & BLOCKMASK_AIR) { width = 32; for (int x2 = x + 1; x < endX; x2 ++) { - if (!(mMetaTiles[x2 + y * mWidth].blockmask & BLOCKMASK_AIR)) - //if (getWalk(x2, y, BLOCKMASK_AIR)) + if (!(mMetaTiles[x2 + y * mWidth].blockmask + & BLOCKMASK_AIR)) + { break; + } width += 32; x ++; } @@ -724,15 +727,17 @@ void Map::drawCollision(Graphics *graphics, int scrollX, int scrollY, } } - if (x < endX && mMetaTiles[x + y * mWidth].blockmask & BLOCKMASK_WATER) -// if (x < endX && !getWalk(x, y, BLOCKMASK_WATER)) + if (x < endX && mMetaTiles[x + y * mWidth].blockmask + & BLOCKMASK_WATER) { width = 32; for (int x2 = x + 1; x < endX; x2 ++) { - if (!(mMetaTiles[x2 + y * mWidth].blockmask & BLOCKMASK_WATER)) -// if (getWalk(x2, y, BLOCKMASK_WATER)) + if (!(mMetaTiles[x2 + y * mWidth].blockmask + & BLOCKMASK_WATER)) + { break; + } width += 32; x ++; } -- cgit v1.2.3-70-g09d2