summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-13 19:10:50 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-13 21:20:33 +0300
commitfcf1da7a161c3e18d393a9b998effc6aa1c366b9 (patch)
tree5f92a8a168dd0748903cc90620a00c7c7bd29377
parentcd0baf3217701134a8e61932fd14c39cec0cf242 (diff)
downloadmanaverse-fcf1da7a161c3e18d393a9b998effc6aa1c366b9.tar.gz
manaverse-fcf1da7a161c3e18d393a9b998effc6aa1c366b9.tar.bz2
manaverse-fcf1da7a161c3e18d393a9b998effc6aa1c366b9.tar.xz
manaverse-fcf1da7a161c3e18d393a9b998effc6aa1c366b9.zip
fix code style.
-rw-r--r--src/chatlogger.cpp1
-rw-r--r--src/configuration.h1
-rw-r--r--src/game.h1
-rw-r--r--src/graphicsmanager.cpp6
-rw-r--r--src/gui/debugwindow.cpp2
-rw-r--r--src/gui/setup_players.cpp4
-rw-r--r--src/gui/setup_video.cpp2
-rw-r--r--src/gui/shopwindow.h1
-rw-r--r--src/gui/widgets/extendedlistbox.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp3
-rw-r--r--src/gui/widgets/textfield.cpp4
-rw-r--r--src/input/inputmanager.cpp4
-rw-r--r--src/net/tmwa/beinghandler.cpp4
-rw-r--r--src/render/graphics.h6
-rw-r--r--src/render/mobileopenglgraphics.h6
-rw-r--r--src/render/normalopenglgraphics.h6
-rw-r--r--src/render/nullopenglgraphics.h6
-rw-r--r--src/render/renderers.h2
-rw-r--r--src/render/rendererslistsdl.h6
-rw-r--r--src/render/rendererslistsdl2.h6
-rw-r--r--src/render/safeopenglgraphics.h6
-rw-r--r--src/render/sdl2graphics.h6
-rw-r--r--src/render/sdl2softwaregraphics.cpp12
-rw-r--r--src/render/sdl2softwaregraphics.h6
-rw-r--r--src/render/sdlgraphics.h6
-rw-r--r--src/render/surfacegraphics.h6
-rw-r--r--src/resources/openglimagehelper.cpp2
-rw-r--r--src/resources/sdlmusic.cpp3
28 files changed, 67 insertions, 53 deletions
diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp
index a0067690b..778b0c31e 100644
--- a/src/chatlogger.cpp
+++ b/src/chatlogger.cpp
@@ -27,6 +27,7 @@
#ifdef WIN32
#include <windows.h>
+#include <sys/time.h>
#elif defined __APPLE__
#include <Carbon/Carbon.h>
#endif
diff --git a/src/configuration.h b/src/configuration.h
index 38bee5d8d..5c36ca4e6 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -29,7 +29,6 @@
#include "defaults.h"
#include "localconsts.h"
-//#include <cassert>
#include <list>
#include <map>
#include <string>
diff --git a/src/game.h b/src/game.h
index 7fdaa8388..b7db9c7b9 100644
--- a/src/game.h
+++ b/src/game.h
@@ -34,7 +34,6 @@ static const int MAX_LASTKEYS = 10;
extern volatile int cur_time;
class Map;
-//class WindowMenu;
struct LastKey final
{
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 73ed3d88a..8891c1856 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -253,6 +253,8 @@ void GraphicsManager::initGraphics(const bool noOpenGL)
#ifndef USE_SDL2
case RENDER_SDL2_DEFAULT:
#endif
+ case RENDER_LAST:
+ case RENDER_NULL:
default:
#ifndef ANDROID
imageHelper = new OpenGLImageHelper;
@@ -305,6 +307,8 @@ void GraphicsManager::initGraphics(const bool noOpenGL A_UNUSED)
case RENDER_SAFE_OPENGL:
case RENDER_GLES_OPENGL:
case RENDER_NORMAL_OPENGL:
+ case RENDER_NULL:
+ case RENDER_LAST:
default:
#ifndef USE_SDL2
case RENDER_SDL2_DEFAULT:
@@ -328,9 +332,7 @@ void GraphicsManager::initGraphics(const bool noOpenGL A_UNUSED)
break;
#endif
};
-
#endif // USE_OPENGL
-
}
void GraphicsManager::setVideoMode()
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 7d19da293..b3cff3087 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -204,6 +204,8 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) :
mFPSText = _("%d FPS (Software)");
break;
case RENDER_NORMAL_OPENGL:
+ case RENDER_NULL:
+ case RENDER_LAST:
default:
// TRANSLATORS: debug window label
mFPSText = _("%d FPS (fast OpenGL)");
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 69a395b4c..928f9952d 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -97,8 +97,8 @@ Setup_Players::Setup_Players(const Widget2 *const widget) :
"hideErased", this, "hideErasedEvent");
// TRANSLATORS: settings option
- new SetupItemCheckBox(_("Use special diagonal speed in players moving"), "",
- "useDiagonalSpeed", this, "useDiagonalSpeedEvent");
+ new SetupItemCheckBox(_("Use special diagonal speed in players moving"),
+ "", "useDiagonalSpeed", this, "useDiagonalSpeedEvent");
setDimension(gcn::Rectangle(0, 0, 550, 350));
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index b04bf7681..b82b25f25 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -565,7 +565,7 @@ void Setup_Video::action(const gcn::ActionEvent &event)
{
const int val = test->getConfig().getValueInt("opengl", -1);
if (val >= 0 && static_cast<unsigned int>(val)
- < sizeof(renderToIndex))
+ < sizeof(renderToIndex) / sizeof (int))
{
mOpenGLDropDown->setSelected(renderToIndex[val]);
}
diff --git a/src/gui/shopwindow.h b/src/gui/shopwindow.h
index 4bcf139cb..7e33416e9 100644
--- a/src/gui/shopwindow.h
+++ b/src/gui/shopwindow.h
@@ -32,7 +32,6 @@ class Button;
class CheckBox;
class Item;
class Label;
-//class ListBox;
class ScrollArea;
class ShopItem;
class ShopItems;
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index 4cf3153b1..cdfafc480 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -165,8 +165,6 @@ void ExtendedListBox::draw(gcn::Graphics *graphics)
}
}
-
-
for (int f = 0; f < selSz; ++f)
{
const ExtendedListBoxItem &item = mSelectedItems[f];
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index a69716f75..5151e44fd 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -282,7 +282,8 @@ void ItemContainer::draw(gcn::Graphics *graphics)
image->setAlpha(1.0f); // ensure the image if fully drawn...
g->drawImage(image, itemX + mPaddingItemX,
itemY + mPaddingItemY);
- if (mProtectedImg && PlayerInfo::isItemProtected(item->getId()))
+ if (mProtectedImg && PlayerInfo::isItemProtected(
+ item->getId()))
{
g->drawImage(mProtectedImg, itemX + mPaddingItemX,
itemY + mPaddingItemY);
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 022a20781..9390e3a24 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -24,6 +24,10 @@
#include "client.h"
+#ifdef ANDROID
+#include "input/inputmanager.h"
+#endif
+
#include "input/keydata.h"
#include "input/keyevent.h"
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index a731dc1f5..12831560a 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -533,7 +533,7 @@ bool InputManager::handleEvent(const SDL_Event &event)
if (gui)
gui->handleInput();
}
- catch (const gcn::Exception &e)
+ catch(const gcn::Exception &e)
{
const char *const err = e.getMessage().c_str();
logger->log("Warning: guichan input exception: %s", err);
@@ -577,7 +577,7 @@ bool InputManager::handleEvent(const SDL_Event &event)
if (guiInput)
guiInput->pushInput(event);
}
- catch (const gcn::Exception &e)
+ catch(const gcn::Exception &e)
{
const char *const err = e.getMessage().c_str();
logger->log("Warning: guichan input exception: %s", err);
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 1a099b3d8..13504cde3 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -669,8 +669,8 @@ void BeingHandler::processBeingMove3(Net::MessageIn &msg) const
if (serverVersion < 10)
return;
- const static int dirx[8] = {0, -1, -1, -1, 0, 1, 1, 1};
- const static int diry[8] = {1, 1, 0, -1, -1, -1, 0, 1};
+ static const int dirx[8] = {0, -1, -1, -1, 0, 1, 1, 1};
+ static const int diry[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int len = msg.readInt16() - 14;
Being *const dstBeing = actorSpriteManager->findBeing(msg.readInt32());
diff --git a/src/render/graphics.h b/src/render/graphics.h
index 3d6a9fa62..16cce7ae6 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef GRAPHICS_H
-#define GRAPHICS_H
+#ifndef RENDER_GRAPHICS_H
+#define RENDER_GRAPHICS_H
#include "SDL.h"
@@ -431,4 +431,4 @@ class Graphics : public gcn::Graphics
extern Graphics *mainGraphics;
-#endif // GRAPHICS_H
+#endif // RENDER_GRAPHICS_H
diff --git a/src/render/mobileopenglgraphics.h b/src/render/mobileopenglgraphics.h
index 1597d3bd9..75b1b3371 100644
--- a/src/render/mobileopenglgraphics.h
+++ b/src/render/mobileopenglgraphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MOBILEOPENGLGRAPHICS_H
-#define MOBILEOPENGLGRAPHICS_H
+#ifndef RENDER_MOBILEOPENGLGRAPHICS_H
+#define RENDER_MOBILEOPENGLGRAPHICS_H
#include "main.h"
#ifdef USE_OPENGL
@@ -229,4 +229,4 @@ class MobileOpenGLGraphics final : public Graphics
};
#endif
-#endif // MOBILEOPENGLGRAPHICS_H
+#endif // RENDER_MOBILEOPENGLGRAPHICS_H
diff --git a/src/render/normalopenglgraphics.h b/src/render/normalopenglgraphics.h
index 2b489c985..737cb9718 100644
--- a/src/render/normalopenglgraphics.h
+++ b/src/render/normalopenglgraphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NORMALOPENGLGRAPHICS_H
-#define NORMALOPENGLGRAPHICS_H
+#ifndef RENDER_NORMALOPENGLGRAPHICS_H
+#define RENDER_NORMALOPENGLGRAPHICS_H
#include "main.h"
#if defined USE_OPENGL && !defined ANDROID
@@ -241,4 +241,4 @@ class NormalOpenGLGraphics final : public Graphics
};
#endif
-#endif // NORMALOPENGLGRAPHICS_H
+#endif // RENDER_NORMALOPENGLGRAPHICS_H
diff --git a/src/render/nullopenglgraphics.h b/src/render/nullopenglgraphics.h
index 856b646bc..0f27590be 100644
--- a/src/render/nullopenglgraphics.h
+++ b/src/render/nullopenglgraphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NULLOPENGLGRAPHICS_H
-#define NULLOPENGLGRAPHICS_H
+#ifndef RENDER_NULLOPENGLGRAPHICS_H
+#define RENDER_NULLOPENGLGRAPHICS_H
#include "main.h"
#if defined USE_OPENGL
@@ -236,4 +236,4 @@ class NullOpenGLGraphics final : public Graphics
};
#endif
-#endif // NULLOPENGLGRAPHICS_H
+#endif // RENDER_NULLOPENGLGRAPHICS_H
diff --git a/src/render/renderers.h b/src/render/renderers.h
index c49ca81c4..2a6af27d2 100644
--- a/src/render/renderers.h
+++ b/src/render/renderers.h
@@ -31,7 +31,7 @@ enum RenderType
RENDER_GLES_OPENGL = 3,
RENDER_SDL2_DEFAULT = 4,
RENDER_NULL = 5,
- RENDER_LAST,
+ RENDER_LAST
};
RenderType intToRenderType(const int mode);
diff --git a/src/render/rendererslistsdl.h b/src/render/rendererslistsdl.h
index aa68eeb6b..ed808485b 100644
--- a/src/render/rendererslistsdl.h
+++ b/src/render/rendererslistsdl.h
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "utils/gettext.h"
-
#ifndef RENDER_RENDERERSLISTSDL_H
#define RENDER_RENDERERSLISTSDL_H
@@ -28,6 +26,10 @@
#else // USE_SDL2
+#include "utils/gettext.h"
+
+#include "render/renderers.h"
+
#ifdef USE_OPENGL
#ifdef ANDROID
// defined OPENGL ANDROID
diff --git a/src/render/rendererslistsdl2.h b/src/render/rendererslistsdl2.h
index 966b53726..10c5d80f3 100644
--- a/src/render/rendererslistsdl2.h
+++ b/src/render/rendererslistsdl2.h
@@ -18,11 +18,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "utils/gettext.h"
-
#ifndef RENDER_RENDERERSLISTSDL2_H
#define RENDER_RENDERERSLISTSDL2_H
+#include "utils/gettext.h"
+
+#include "render/renderers.h"
+
#ifdef USE_SDL2
#ifdef USE_OPENGL
diff --git a/src/render/safeopenglgraphics.h b/src/render/safeopenglgraphics.h
index 2c31bb696..93f67d75e 100644
--- a/src/render/safeopenglgraphics.h
+++ b/src/render/safeopenglgraphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SAFEOPENGLGRAPHICS_H
-#define SAFEOPENGLGRAPHICS_H
+#ifndef RENDER_SAFEOPENGLGRAPHICS_H
+#define RENDER_SAFEOPENGLGRAPHICS_H
#include "main.h"
#if defined USE_OPENGL && !defined ANDROID
@@ -180,4 +180,4 @@ class SafeOpenGLGraphics final : public Graphics
};
#endif
-#endif // SAFEOPENGLGRAPHICS_H
+#endif // RENDER_SAFEOPENGLGRAPHICS_H
diff --git a/src/render/sdl2graphics.h b/src/render/sdl2graphics.h
index 383e93540..e53719049 100644
--- a/src/render/sdl2graphics.h
+++ b/src/render/sdl2graphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SDL2GRAPHICS_H
-#define SDL2GRAPHICS_H
+#ifndef RENDER_SDL2GRAPHICS_H
+#define RENDER_SDL2GRAPHICS_H
#ifdef USE_SDL2
@@ -144,4 +144,4 @@ class SDLGraphics : public Graphics
};
#endif // USE_SDL2
-#endif // SDL2GRAPHICS_H
+#endif // RENDER_SDL2GRAPHICS_H
diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp
index ac9f962ac..c1df5b3d0 100644
--- a/src/render/sdl2softwaregraphics.cpp
+++ b/src/render/sdl2softwaregraphics.cpp
@@ -745,8 +745,8 @@ void SDL2SoftwareGraphics::fillRectangle(const gcn::Rectangle &rectangle)
case 2:
for (y = y1; y < y2; y++)
{
- uint8_t *const p0 = static_cast<uint8_t *>(mSurface->pixels)
- + y * mSurface->pitch;
+ uint8_t *const p0 = static_cast<uint8_t *>(
+ mSurface->pixels) + y * mSurface->pitch;
for (x = x1; x < x2; x++)
{
uint8_t *const p = p0 + x * 2;
@@ -766,8 +766,8 @@ void SDL2SoftwareGraphics::fillRectangle(const gcn::Rectangle &rectangle)
for (y = y1; y < y2; y++)
{
- uint8_t *const p0 = static_cast<uint8_t *>(mSurface->pixels)
- + y * mSurface->pitch;
+ uint8_t *const p0 = static_cast<uint8_t *>(
+ mSurface->pixels) + y * mSurface->pitch;
for (x = x1; x < x2; x++)
{
uint8_t *const p = p0 + x * 3;
@@ -794,8 +794,8 @@ void SDL2SoftwareGraphics::fillRectangle(const gcn::Rectangle &rectangle)
for (y = y1; y < y2; y++)
{
- uint8_t *const p0 = static_cast<uint8_t *>(mSurface->pixels)
- + y * mSurface->pitch;
+ uint8_t *const p0 = static_cast<uint8_t *>(
+ mSurface->pixels) + y * mSurface->pitch;
for (x = x1; x < x2; x++)
{
uint8_t *p = p0 + x * 4;
diff --git a/src/render/sdl2softwaregraphics.h b/src/render/sdl2softwaregraphics.h
index 9fd53909d..19bf49373 100644
--- a/src/render/sdl2softwaregraphics.h
+++ b/src/render/sdl2softwaregraphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SDL2SOFTWAREGRAPHICS_H
-#define SDL2SOFTWAREGRAPHICS_H
+#ifndef RENDER_SDL2SOFTWAREGRAPHICS_H
+#define RENDER_SDL2SOFTWAREGRAPHICS_H
#ifdef USE_SDL2
@@ -156,4 +156,4 @@ class SDL2SoftwareGraphics : public Graphics
};
#endif // USE_SDL2
-#endif // SDL2SOFTWAREGRAPHICS_H
+#endif // RENDER_SDL2SOFTWAREGRAPHICS_H
diff --git a/src/render/sdlgraphics.h b/src/render/sdlgraphics.h
index a7e4be85b..28393d251 100644
--- a/src/render/sdlgraphics.h
+++ b/src/render/sdlgraphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SDLGRAPHICS_H
-#define SDLGRAPHICS_H
+#ifndef RENDER_SDLGRAPHICS_H
+#define RENDER_SDLGRAPHICS_H
#ifdef USE_SDL2
#include "render/sdl2graphics.h"
@@ -152,4 +152,4 @@ class SDLGraphics : public Graphics
};
#endif // USE_SDL2
-#endif // SDLGRAPHICS_H
+#endif // RENDER_SDLGRAPHICS_H
diff --git a/src/render/surfacegraphics.h b/src/render/surfacegraphics.h
index f5194946a..06dffd4ed 100644
--- a/src/render/surfacegraphics.h
+++ b/src/render/surfacegraphics.h
@@ -20,8 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SURFACEGRAPHICS_H
-#define SURFACEGRAPHICS_H
+#ifndef RENDER_SURFACEGRAPHICS_H
+#define RENDER_SURFACEGRAPHICS_H
#include "render/graphics.h"
@@ -182,4 +182,4 @@ class SurfaceGraphics : public Graphics
SDL_Surface *mTarget;
};
-#endif // SURFACEGRAPHICS_H
+#endif // RENDER_SURFACEGRAPHICS_H
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 014c33362..2216659a3 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -215,6 +215,8 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
break;
case RENDER_SOFTWARE:
case RENDER_SDL2_DEFAULT:
+ case RENDER_NULL:
+ case RENDER_LAST:
default:
logger->log("Unknown OpenGL backend: %d", mUseOpenGL);
break;
diff --git a/src/resources/sdlmusic.cpp b/src/resources/sdlmusic.cpp
index 6f1d81731..ef8ebb56d 100644
--- a/src/resources/sdlmusic.cpp
+++ b/src/resources/sdlmusic.cpp
@@ -41,6 +41,9 @@ Resource *SDLMusic::load(SDL_RWops *const rw)
{
#ifdef USE_SDL2
if (Mix_Music *const music = Mix_LoadMUSType_RW(rw, MUS_OGG, 1))
+#elif defined ANDROID
+ // +++ here probably mem leak
+ if (Mix_Music *const music = Mix_LoadMUS_RW(rw))
#else
if (Mix_Music *const music = Mix_LoadMUSType_RW(rw, MUS_OGG, SDL_TRUE))
#endif