summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-01 21:35:49 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-01 22:40:36 +0300
commitfc854786ed73fe768d6a3ca22c02f7013560a930 (patch)
tree3a12f555d194679957559760567ff8eb701b494b /src/gui
parent09d74d9273cca445b7019edacaff53452a1eee3c (diff)
downloadmv-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.gz
mv-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.bz2
mv-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.xz
mv-fc854786ed73fe768d6a3ca22c02f7013560a930.zip
Fix code style.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charselectdialog.cpp19
-rw-r--r--src/gui/chatwindow.cpp5
-rw-r--r--src/gui/socialwindow.h2
-rw-r--r--src/gui/theme.h2
-rw-r--r--src/gui/viewport.cpp45
-rw-r--r--src/gui/widgets/shoplistbox.cpp2
6 files changed, 39 insertions, 36 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index a212d08c4..95f76d228 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -530,16 +530,19 @@ bool CharSelectDialog::selectByName(const std::string &name,
for (int i = 0; i < static_cast<int>(mCharacterEntries.size()); ++i)
{
- Net::Character *character = mCharacterEntries[i]->getCharacter();
- if (mCharacterEntries[i] && character)
+ if (mCharacterEntries[i])
{
- if (character->dummy && character->dummy->getName() == name)
+ Net::Character *character = mCharacterEntries[i]->getCharacter();
+ if (character)
{
- if (mCharacterEntries[i])
- mCharacterEntries[i]->requestFocus();
- if (selAction == Choose)
- attemptCharacterSelect(i);
- return true;
+ if (character->dummy && character->dummy->getName() == name)
+ {
+ if (mCharacterEntries[i])
+ mCharacterEntries[i]->requestFocus();
+ if (selAction == Choose)
+ attemptCharacterSelect(i);
+ return true;
+ }
}
}
}
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 75ec6d09c..0229f9da5 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -845,11 +845,12 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
ChatTab *tab = getFocused();
if (tab && tab->hasRows())
{
- if (mChatHistoryIndex + 1 < tab->getRows().size())
+ const size_t tabSize = tab->getRows().size();
+ if (mChatHistoryIndex + 1 < tabSize)
{
mChatHistoryIndex ++;
}
- else if (mChatHistoryIndex < tab->getRows().size())
+ else if (mChatHistoryIndex < tabSize)
{
mChatHistoryIndex ++;
mChatInput->setText("");
diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h
index e4eac29ae..478b62bfe 100644
--- a/src/gui/socialwindow.h
+++ b/src/gui/socialwindow.h
@@ -110,7 +110,7 @@ public:
bool getProcessedPortals() const
{ return mProcessedPortals; }
- void setProcessedPortals(int n)
+ void setProcessedPortals(bool n)
{ mProcessedPortals = n; }
void selectPortal(unsigned num);
diff --git a/src/gui/theme.h b/src/gui/theme.h
index 69a08bff0..216b19802 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -34,6 +34,8 @@
#include <map>
+#include "localconsts.h"
+
class DyePalette;
class Image;
class ImageSet;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 2a8d36a60..194ad7310 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -139,7 +139,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
// Calculate viewpoint
int midTileX = (graphics->mWidth + mScrollCenterOffsetX) / 2;
- int midTileY = (graphics->mHeight + mScrollCenterOffsetX) / 2;
+ int midTileY = (graphics->mHeight + mScrollCenterOffsetY) / 2;
const Vector &playerPos = player_node->getPosition();
const int player_x = static_cast<int>(playerPos.x)
@@ -219,27 +219,25 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
mMap->getWidth() * mMap->getTileWidth() - graphics->mWidth;
const int viewYmax =
mMap->getHeight() * mMap->getTileHeight() - graphics->mHeight;
- if (mMap)
+
+ if (mPixelViewX < 0)
+ mPixelViewX = 0;
+ if (mPixelViewY < 0)
+ mPixelViewY = 0;
+ if (mPixelViewX > viewXmax)
+ mPixelViewX = viewXmax;
+ if (mPixelViewY > viewYmax)
+ mPixelViewY = viewYmax;
+
+ // Draw tiles and sprites
+ mMap->draw(graphics, mPixelViewX, mPixelViewY);
+
+ if (mShowDebugPath)
{
- if (mPixelViewX < 0)
- mPixelViewX = 0;
- if (mPixelViewY < 0)
- mPixelViewY = 0;
- if (mPixelViewX > viewXmax)
- mPixelViewX = viewXmax;
- if (mPixelViewY > viewYmax)
- mPixelViewY = viewYmax;
-
- // Draw tiles and sprites
- mMap->draw(graphics, mPixelViewX, mPixelViewY);
-
- if (mShowDebugPath)
- {
- mMap->drawCollision(graphics, mPixelViewX,
- mPixelViewY, mShowDebugPath);
- if (mShowDebugPath == Map::MAP_DEBUG)
- _drawDebugPath(graphics);
- }
+ mMap->drawCollision(graphics, mPixelViewX,
+ mPixelViewY, mShowDebugPath);
+ if (mShowDebugPath == Map::MAP_DEBUG)
+ _drawDebugPath(graphics);
}
if (player_node->getCheckNameSetting())
@@ -780,10 +778,9 @@ void Viewport::mouseMoved(gcn::MouseEvent &event A_UNUSED)
{
if (!mHoverSign->getComment().empty())
{
- if (mBeingPopup)
- mBeingPopup->setVisible(false);
+ mBeingPopup->setVisible(false);
mTextPopup->show(getMouseX(), getMouseY(),
- mHoverSign->getComment());
+ mHoverSign->getComment());
}
else
{
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 3031460c4..6171e9f03 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -118,7 +118,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
temp = mWarningColor;
temp.r = (temp.r + mHighlightColor.r) / 2;
temp.g = (temp.g + mHighlightColor.g) / 2;
- temp.b = (temp.g + mHighlightColor.b) / 2;
+ temp.b = (temp.b + mHighlightColor.b) / 2;
temp.a = alpha;
backgroundColor = &temp;
}