summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-22 19:50:00 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-22 22:33:52 +0300
commita8d90b8a84b5a21c53fb5d279dc983ae1e2c3217 (patch)
treef1e35affbe927a1e81fcfafe91747fe3c1e3f56d /src
parent3e75f388c21a7c9a00ef2ff802023be00431248a (diff)
downloadManaVerse-a8d90b8a84b5a21c53fb5d279dc983ae1e2c3217.tar.gz
ManaVerse-a8d90b8a84b5a21c53fb5d279dc983ae1e2c3217.tar.bz2
ManaVerse-a8d90b8a84b5a21c53fb5d279dc983ae1e2c3217.tar.xz
ManaVerse-a8d90b8a84b5a21c53fb5d279dc983ae1e2c3217.zip
Fix code style.
Diffstat (limited to 'src')
-rw-r--r--src/configuration.cpp2
-rw-r--r--src/effectmanager.h1
-rw-r--r--src/gui/setup_joystick.cpp2
-rw-r--r--src/guichan/color.cpp18
-rw-r--r--src/guichan/defaultfont.cpp2
-rw-r--r--src/guichan/focushandler.cpp20
-rw-r--r--src/guichan/include/guichan/sdl/sdlpixel.hpp23
-rw-r--r--src/guichan/sdl/sdlimage.cpp4
-rw-r--r--src/localplayer.cpp2
-rw-r--r--src/opengl1graphics.h4
-rw-r--r--src/openglgraphics.h6
-rw-r--r--src/particleemitterprop.h1
-rw-r--r--src/utils/mathutils.h2
-rw-r--r--src/utils/translation/poparser.cpp2
14 files changed, 48 insertions, 41 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 1ff205195..694f94e78 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -334,7 +334,7 @@ float Configuration::getFloatValue(const std::string &key) const
(static_cast<FloatData*>(itdef->second))->getData());
}
else if (itdef->second->getType()
- == VariableData::DATA_STRING)
+ == VariableData::DATA_STRING)
{
defaultValue = atof((static_cast<StringData*>(
itdef->second))->getData().c_str());
diff --git a/src/effectmanager.h b/src/effectmanager.h
index df19a0040..f8babd2f5 100644
--- a/src/effectmanager.h
+++ b/src/effectmanager.h
@@ -24,6 +24,7 @@
#include <list>
#include <string>
+#include <vector>
class Being;
diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp
index 290607be4..a3240282a 100644
--- a/src/gui/setup_joystick.cpp
+++ b/src/gui/setup_joystick.cpp
@@ -146,7 +146,7 @@ void Setup_Joystick::action(const gcn::ActionEvent &event)
{
mCalibrateButton->setCaption(_("Stop"));
mCalibrateLabel->setCaption(
- _("Rotate the stick and dont press buttons"));
+ _("Rotate the stick and don't press buttons"));
joystick->startCalibration();
}
}
diff --git a/src/guichan/color.cpp b/src/guichan/color.cpp
index d3dc7a738..f58e7b58e 100644
--- a/src/guichan/color.cpp
+++ b/src/guichan/color.cpp
@@ -97,23 +97,23 @@ namespace gcn
b - color.b,
255);
- result.r = (result.r>255?255:(result.r<0?0:result.r));
- result.g = (result.g>255?255:(result.g<0?0:result.g));
- result.b = (result.b>255?255:(result.b<0?0:result.b));
+ result.r = (result.r > 255 ? 255 : (result.r < 0 ? 0 : result.r));
+ result.g = (result.g > 255 ? 255 : (result.g < 0 ? 0 : result.g));
+ result.b = (result.b > 255 ? 255 : (result.b < 0 ? 0 : result.b));
return result;
}
Color Color::operator*(float value) const
{
- Color result((int)(r * value),
- (int)(g * value),
- (int)(b * value),
+ Color result(static_cast<int>(r * value),
+ static_cast<int>(g * value),
+ static_cast<int>(b * value),
a);
- result.r = (result.r>255?255:(result.r<0?0:result.r));
- result.g = (result.g>255?255:(result.g<0?0:result.g));
- result.b = (result.b>255?255:(result.b<0?0:result.b));
+ result.r = (result.r > 255 ? 255 : (result.r < 0 ? 0 : result.r));
+ result.g = (result.g > 255 ? 255 : (result.g < 0 ? 0 : result.g));
+ result.b = (result.b > 255 ? 255 : (result.b < 0 ? 0 : result.b));
return result;
}
diff --git a/src/guichan/defaultfont.cpp b/src/guichan/defaultfont.cpp
index 8871d51de..70901bc8e 100644
--- a/src/guichan/defaultfont.cpp
+++ b/src/guichan/defaultfont.cpp
@@ -89,7 +89,7 @@ namespace gcn
int DefaultFont::getStringIndexAt(const std::string& text, int x) const
{
- if (x > (int)text.size() * 8)
+ if (x > static_cast<int>(text.size() * 8))
return text.size();
return x / 8;
diff --git a/src/guichan/focushandler.cpp b/src/guichan/focushandler.cpp
index 832a201ad..e3610fb1e 100644
--- a/src/guichan/focushandler.cpp
+++ b/src/guichan/focushandler.cpp
@@ -158,7 +158,7 @@ namespace gcn
{
int i;
int focusedWidget = -1;
- for (i = 0; i < (int)mWidgets.size(); ++i)
+ for (i = 0; i < static_cast<int>(mWidgets.size()); ++i)
{
if (mWidgets[i] == mFocusedWidget)
focusedWidget = i;
@@ -167,7 +167,7 @@ namespace gcn
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
- i = (int)mWidgets.size();
+ i = static_cast<int>(mWidgets.size());
do
{
++ focusedWidget;
@@ -180,7 +180,7 @@ namespace gcn
-- i;
- if (focusedWidget >= (int)mWidgets.size())
+ if (focusedWidget >= static_cast<int>(mWidgets.size()))
focusedWidget = 0;
if (focusedWidget == focused)
@@ -213,7 +213,7 @@ namespace gcn
int i;
int focusedWidget = -1;
- for (i = 0; i < (int)mWidgets.size(); ++ i)
+ for (i = 0; i < static_cast<int>(mWidgets.size()); ++ i)
{
if (mWidgets[i] == mFocusedWidget)
focusedWidget = i;
@@ -222,7 +222,7 @@ namespace gcn
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
- i = (int)mWidgets.size();
+ i = static_cast<int>(mWidgets.size());
do
{
-- focusedWidget;
@@ -342,7 +342,7 @@ namespace gcn
int i;
int focusedWidget = -1;
- for (i = 0; i < (int)mWidgets.size(); ++i)
+ for (i = 0; i < static_cast<int>(mWidgets.size()); ++ i)
{
if (mWidgets[i] == mFocusedWidget)
focusedWidget = i;
@@ -352,7 +352,7 @@ namespace gcn
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
- i = (int)mWidgets.size();
+ i = static_cast<int>(mWidgets.size());
do
{
++ focusedWidget;
@@ -365,7 +365,7 @@ namespace gcn
-- i;
- if (focusedWidget >= (int)mWidgets.size())
+ if (focusedWidget >= static_cast<int>(mWidgets.size()))
focusedWidget = 0;
if (focusedWidget == focused)
@@ -411,7 +411,7 @@ namespace gcn
int i;
int focusedWidget = -1;
- for (i = 0; i < (int)mWidgets.size(); ++i)
+ for (i = 0; i < static_cast<int>(mWidgets.size()); ++ i)
{
if (mWidgets[i] == mFocusedWidget)
focusedWidget = i;
@@ -421,7 +421,7 @@ namespace gcn
// i is a counter that ensures that the following loop
// won't get stuck in an infinite loop
- i = (int)mWidgets.size();
+ i = static_cast<int>(mWidgets.size());
do
{
-- focusedWidget;
diff --git a/src/guichan/include/guichan/sdl/sdlpixel.hpp b/src/guichan/include/guichan/sdl/sdlpixel.hpp
index a0221ca7c..bfd08341b 100644
--- a/src/guichan/include/guichan/sdl/sdlpixel.hpp
+++ b/src/guichan/include/guichan/sdl/sdlpixel.hpp
@@ -68,7 +68,8 @@ namespace gcn
SDL_LockSurface(surface);
- Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+ Uint8 *p = static_cast<Uint8*>(surface->pixels)
+ + y * surface->pitch + x * bpp;
unsigned int color = 0;
@@ -79,7 +80,7 @@ namespace gcn
break;
case 2:
- color = *(Uint16 *)p;
+ color = *reinterpret_cast<Uint16*>(p);
break;
case 3:
@@ -90,7 +91,7 @@ namespace gcn
break;
case 4:
- color = *(Uint32 *)p;
+ color = *reinterpret_cast<Uint32*>(p);
break;
default:
@@ -123,7 +124,7 @@ namespace gcn
SDL_LockSurface(surface);
- Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+ Uint8 *p = static_cast<Uint8*>(surface->pixels) + y * surface->pitch + x * bpp;
Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b);
@@ -134,7 +135,7 @@ namespace gcn
break;
case 2:
- *(Uint16 *)p = pixel;
+ *reinterpret_cast<Uint16*>(p) = pixel;
break;
case 3:
@@ -153,7 +154,7 @@ namespace gcn
break;
case 4:
- *(Uint32 *)p = pixel;
+ *reinterpret_cast<Uint32*>(p) = pixel;
break;
default:
@@ -199,7 +200,7 @@ namespace gcn
unsigned int r = ((src & f->Bmask) * a + (dst & f->Bmask)
* (255 - a)) >> 8;
- return (unsigned short)((b & f->Rmask)
+ return static_cast<unsigned short>((b & f->Rmask)
| (g & f->Gmask) | (r & f->Bmask));
}
@@ -230,7 +231,8 @@ namespace gcn
SDL_LockSurface(surface);
- Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
+ Uint8 *p = static_cast<Uint8*>(surface->pixels)
+ + y * surface->pitch + x * bpp;
Uint32 pixel = SDL_MapRGB(surface->format, color.r, color.g, color.b);
@@ -241,7 +243,7 @@ namespace gcn
break;
case 2:
- *(Uint16 *)p = SDLAlpha16(pixel, *(Uint32 *)p,
+ *reinterpret_cast<Uint16*>(p) = SDLAlpha16(pixel, *(Uint32 *)p,
color.a, surface->format);
break;
@@ -275,7 +277,8 @@ namespace gcn
break;
case 4:
- *(Uint32 *)p = SDLAlpha32(pixel, *(Uint32 *)p, color.a);
+ *reinterpret_cast<Uint32*>(p) = SDLAlpha32(pixel,
+ *reinterpret_cast<Uint32*>(p), color.a);
break;
default:
break;
diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp
index e4aadc465..4f9b9565c 100644
--- a/src/guichan/sdl/sdlimage.cpp
+++ b/src/guichan/sdl/sdlimage.cpp
@@ -130,8 +130,8 @@ namespace gcn
for (i = 0; i < mSurface->w * mSurface->h; ++i)
{
- if (((unsigned int*)mSurface->pixels)[i] == SDL_MapRGB(
- mSurface->format, 255, 0, 255))
+ if ((static_cast<unsigned int*>(mSurface->pixels))[i]
+ == SDL_MapRGB(mSurface->format, 255, 0, 255))
{
hasPink = true;
break;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 03199f7be..b07511196 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -2153,7 +2153,7 @@ static const char *pvpAttackStrings[] =
N_("(a) attack all players"),
N_("(f) attack all except friends"),
N_("(b) attack bad relations"),
- N_("(d) dont attack players"),
+ N_("(d) don't attack players"),
N_("(?) pvp attack")
};
diff --git a/src/opengl1graphics.h b/src/opengl1graphics.h
index 76dc3ef00..8cc3c89a7 100644
--- a/src/opengl1graphics.h
+++ b/src/opengl1graphics.h
@@ -23,15 +23,14 @@
#ifndef OPENGL1GRAPHICS_H
#define OPENGL1GRAPHICS_H
+#ifdef USE_OPENGL
#include "main.h"
#include "graphics.h"
-#ifdef USE_OPENGL
#define NO_SDL_GLEXT
#include <SDL_opengl.h>
-#endif
class OpenGL1Graphics : public Graphics
{
@@ -140,5 +139,6 @@ class OpenGL1Graphics : public Graphics
bool mColorAlpha;
bool mSync;
};
+#endif
#endif
diff --git a/src/openglgraphics.h b/src/openglgraphics.h
index f3bdc4470..9eeb530ac 100644
--- a/src/openglgraphics.h
+++ b/src/openglgraphics.h
@@ -23,15 +23,14 @@
#ifndef OPENGLGRAPHICS_H
#define OPENGLGRAPHICS_H
-#include "main.h"
+#ifdef USE_OPENGL
+#include "main.h"
#include "graphics.h"
-#ifdef USE_OPENGL
#define NO_SDL_GLEXT
#include <SDL_opengl.h>
-#endif
class OpenGLGraphics : public Graphics
{
@@ -154,5 +153,6 @@ class OpenGLGraphics : public Graphics
bool mColorAlpha;
bool mSync;
};
+#endif
#endif
diff --git a/src/particleemitterprop.h b/src/particleemitterprop.h
index cadfa0f3a..2b6b7ba1a 100644
--- a/src/particleemitterprop.h
+++ b/src/particleemitterprop.h
@@ -21,6 +21,7 @@
*/
#include <cmath>
+#include <cstdlib>
/**
* Returns a random numeric value that is larger than or equal min and smaller
diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h
index 8ccd71e79..6d5a8339d 100644
--- a/src/utils/mathutils.h
+++ b/src/utils/mathutils.h
@@ -23,7 +23,9 @@
#ifndef UTILS_MATHUTILS_H
#define UTILS_MATHUTILS_H
+#include <string>
#include <stdint.h>
+#include <cstring>
static uint16_t crc_table[256] =
{
diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp
index 24d2ee4d4..521774592 100644
--- a/src/utils/translation/poparser.cpp
+++ b/src/utils/translation/poparser.cpp
@@ -144,7 +144,7 @@ bool PoParser::readMsgId()
mLine = "";
return true;
}
- // stop reading if we dont read msgid before
+ // stop reading if we don't read msgid before
return mMsgId.empty();
}
}