summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-28 13:47:32 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-28 13:47:32 +0300
commitfbcfa27edf518835976e140ec160db009186bc16 (patch)
tree52e2999ffe9ba3971f2b4334be7c8c42754a7e03
parentcaf62e4d1c039f8d4d33bfd05f476890fdc79fcf (diff)
downloadmv-fbcfa27edf518835976e140ec160db009186bc16.tar.gz
mv-fbcfa27edf518835976e140ec160db009186bc16.tar.bz2
mv-fbcfa27edf518835976e140ec160db009186bc16.tar.xz
mv-fbcfa27edf518835976e140ec160db009186bc16.zip
Fix code style and add some checks.
-rw-r--r--src/graphics.cpp2
-rw-r--r--src/gui/chatwindow.cpp5
-rw-r--r--src/gui/setup.cpp4
-rw-r--r--src/gui/setup_perfomance.cpp9
-rw-r--r--src/gui/viewport.cpp2
-rw-r--r--src/guichan/include/guichan/selectionlistener.hpp2
-rw-r--r--src/guichan/include/guichan/widgetlistener.hpp2
-rw-r--r--src/map.cpp4
-rw-r--r--src/resources/image.cpp18
-rw-r--r--src/test/testlauncher.cpp6
10 files changed, 35 insertions, 19 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 04754a975..f07c6b48d 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -968,7 +968,7 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
for (x = x1; x < x2; x++)
{
Uint32 *p = p0 + x;
- Uint32 dst = *reinterpret_cast<Uint32*>(p);
+ const Uint32 dst = *p;
*p = cB[dst & 0xff] | cG[(dst & 0xff00) >> 8]
| cR[(dst & 0xff0000) >> 16];
}
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index c33478cc5..bc8bd1f83 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -858,8 +858,9 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
}
unsigned int f = 0;
- for (std::list<std::string>::const_iterator it = tab->getRows().begin(),
- it_end = tab->getRows().end(); it != it_end; ++it, f++)
+ for (std::list<std::string>::const_iterator
+ it = tab->getRows().begin(), it_end = tab->getRows().end();
+ it != it_end; ++it, f++)
{
if (f == mChatHistoryIndex)
mChatInput->setText(*it);
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 9f7ae209d..b0d2f4ec0 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -182,8 +182,8 @@ void Setup::setInGame(bool inGame)
void Setup::externalUpdate()
{
- for (std::list<SetupTab*>::const_iterator it = mTabs.begin(), it_end = mTabs.end();
- it != it_end; ++ it)
+ for (std::list<SetupTab*>::const_iterator it = mTabs.begin(),
+ it_end = mTabs.end(); it != it_end; ++ it)
{
if (*it)
(*it)->externalUpdated();
diff --git a/src/gui/setup_perfomance.cpp b/src/gui/setup_perfomance.cpp
index 285c2baab..a40a400f3 100644
--- a/src/gui/setup_perfomance.cpp
+++ b/src/gui/setup_perfomance.cpp
@@ -90,15 +90,14 @@ Setup_Perfomance::Setup_Perfomance()
"disableBeingCaching", this, "disableBeingCachingEvent");
- new SetupItemLabel(_("Different options (enable or disable can improve perfomance)"),
- "", this);
+ new SetupItemLabel(_("Different options (enable or disable can "
+ "improve perfomance)"), "", this);
new SetupItemCheckBox(_("Enable texture compression (fast OpenGL)"), "",
"compresstextures", this, "compresstexturesEvent");
- new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"), "",
- "rectangulartextures", this, "rectangulartexturesEvent");
-
+ new SetupItemCheckBox(_("Enable rectangular texture extension (OpenGL)"),
+ "", "rectangulartextures", this, "rectangulartexturesEvent");
setDimension(gcn::Rectangle(0, 0, 550, 350));
}
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index d07f80e1c..65ca8071c 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -196,7 +196,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
// if (debugChatTab)
// debugChatTab->chatLog("incorrect player position!");
logger->log("incorrect player position: %d, %d, %d, %d",
- player_x, player_y, mPixelViewX,mPixelViewY);
+ player_x, player_y, mPixelViewX, mPixelViewY);
if (player_node)
{
logger->log("tile position: %d, %d",
diff --git a/src/guichan/include/guichan/selectionlistener.hpp b/src/guichan/include/guichan/selectionlistener.hpp
index 6415ff0a6..837f35fcf 100644
--- a/src/guichan/include/guichan/selectionlistener.hpp
+++ b/src/guichan/include/guichan/selectionlistener.hpp
@@ -50,6 +50,8 @@
#include "guichan/selectionevent.hpp"
#include "guichan/platform.hpp"
+#include "localconsts.h"
+
namespace gcn
{
/**
diff --git a/src/guichan/include/guichan/widgetlistener.hpp b/src/guichan/include/guichan/widgetlistener.hpp
index 6bb376bf6..ae148e62c 100644
--- a/src/guichan/include/guichan/widgetlistener.hpp
+++ b/src/guichan/include/guichan/widgetlistener.hpp
@@ -50,6 +50,8 @@
#include "guichan/event.hpp"
#include "guichan/platform.hpp"
+#include "localconsts.h"
+
namespace gcn
{
/**
diff --git a/src/map.cpp b/src/map.cpp
index 1ffe20dd4..f843479c0 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -108,8 +108,8 @@ bool TileAnimation::update(int ticks)
Image *img = mAnimation->getCurrentImage();
if (img != mLastImage)
{
- for (TilePairVectorCIter i = mAffected.begin(), i_end = mAffected.end();
- i != i_end; ++i)
+ for (TilePairVectorCIter i = mAffected.begin(),
+ i_end = mAffected.end(); i != i_end; ++i)
{
if (i->first)
i->first->setTile(i->second, img);
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 274262304..fa9f1462a 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -940,10 +940,20 @@ SubImage::SubImage(Image *parent, GLuint image,
mBounds.y = static_cast<short>(y);
mBounds.w = static_cast<Uint16>(width);
mBounds.h = static_cast<Uint16>(height);
- mInternalBounds.x = mParent->mBounds.x;
- mInternalBounds.y = mParent->mBounds.y;
- mInternalBounds.w = mParent->mBounds.w;
- mInternalBounds.h = mParent->mBounds.h;
+ if (mParent)
+ {
+ mInternalBounds.x = mParent->mBounds.x;
+ mInternalBounds.y = mParent->mBounds.y;
+ mInternalBounds.w = mParent->mBounds.w;
+ mInternalBounds.h = mParent->mBounds.h;
+ }
+ else
+ {
+ mInternalBounds.x = 0;
+ mInternalBounds.y = 0;
+ mInternalBounds.w = 1;
+ mInternalBounds.h = 1;
+ }
mIsAlphaVisible = mHasAlphaChannel;
}
#endif
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index 55273ab41..6818c0b3c 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -166,8 +166,10 @@ int TestLauncher::testInternal()
Wallpaper::getWallpaper(800, 600);
Image *img[4];
- img[0] = Theme::getImageFromTheme("graphics/sprites/manaplus_emotions.png");
- img[1] = Theme::getImageFromTheme("graphics/sprites/manaplus_emotions.png");
+ img[0] = Theme::getImageFromTheme(
+ "graphics/sprites/manaplus_emotions.png");
+ img[1] = Theme::getImageFromTheme(
+ "graphics/sprites/manaplus_emotions.png");
img[2] = Theme::getImageFromTheme("graphics/sprites/arrow_left.gif");
img[3] = Theme::getImageFromTheme("graphics/sprites/arrow_right.gif");
int idx = 0;