From 55d43e6dfd890df0ce7b26f6c9cb5692e2c136b1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 18 Aug 2016 23:08:12 +0300 Subject: Fix some style issues. --- src/dyetool/client.cpp | 33 ++++--- src/input/inputactionmap.h | 3 +- src/render/mobileopenglgraphics.cpp | 160 +++++++++++++++----------------- src/resources/map/map.cpp | 10 +- src/resources/openglimagehelper.cpp | 14 +-- src/resources/safeopenglimagehelper.cpp | 14 +-- src/sdl2gfx/SDL2_framerate.h | 3 +- src/sdl2gfx/SDL2_rotozoom.h | 3 +- src/utils/xml/pugixml.cpp | 18 ++-- 9 files changed, 131 insertions(+), 127 deletions(-) diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp index 8872aa134..e4d61688f 100644 --- a/src/dyetool/client.cpp +++ b/src/dyetool/client.cpp @@ -188,17 +188,18 @@ void Client::gameInit() GettextHelper::initLang(); -// chatLogger = new ChatLogger; -// if (settings.options.chatLogDir.empty()) -// { -// chatLogger->setBaseLogDir(settings.localDataDir -// + std::string("/logs/")); -// } -// else -// { -// chatLogger->setBaseLogDir(settings.options.chatLogDir); -// } - +/* + chatLogger = new ChatLogger; + if (settings.options.chatLogDir.empty()) + { + chatLogger->setBaseLogDir(settings.localDataDir + + std::string("/logs/")); + } + else + { + chatLogger->setBaseLogDir(settings.options.chatLogDir); + } +*/ logger->setLogToStandardOut(config.getBoolValue("logToStandardOut")); // Log the client version @@ -571,10 +572,12 @@ int Client::gameExec() BLOCK_END("~Client::SDL_framerateDelay") BLOCK_START("Client::gameExec 6") -// if (mState == State::CONNECT_GAME) -// { -// stateConnectGame1(); -// } +/* + if (mState == State::CONNECT_GAME) + { + stateConnectGame1(); + } +*/ BLOCK_END("Client::gameExec 6") if (mState != mOldState) diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 402056ecc..ed8cddb92 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -56,7 +56,8 @@ // keyData must be in same order as enum keyAction. static const InputActionData inputActionData - [CAST_SIZE(InputAction::TOTAL)] = { + [CAST_SIZE(InputAction::TOTAL)] = + { {"keyMoveUp", addKey(SDLK_UP), emptyKey, diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp index 64f01b8b3..83d57e33b 100644 --- a/src/render/mobileopenglgraphics.cpp +++ b/src/render/mobileopenglgraphics.cpp @@ -377,37 +377,33 @@ void MobileOpenGLGraphics::drawPatternCached(const Image *restrict const image, unsigned int vp = mVpCached; const unsigned int vLimit = mMaxVertices * 4; - // Draw a set of textured rectangles -// if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) -// { - const float texX1 = static_cast(srcX) / tw; - const float texY1 = static_cast(srcY) / th; + const float texX1 = static_cast(srcX) / tw; + const float texY1 = static_cast(srcY) / th; - for (int py = 0; py < h; py += ih) + for (int py = 0; py < h; py += ih) + { + const int height = (py + ih >= h) ? h - py : ih; + const float texY2 = static_cast(srcY + height) / th; + const int dstY = y + py; + for (int px = 0; px < w; px += iw) { - const int height = (py + ih >= h) ? h - py : ih; - const float texY2 = static_cast(srcY + height) / th; - const int dstY = y + py; - for (int px = 0; px < w; px += iw) - { - const int width = (px + iw >= w) ? w - px : iw; - const int dstX = x + px; + const int width = (px + iw >= w) ? w - px : iw; + const int dstX = x + px; - const float texX2 = static_cast(srcX + width) / tw; + const float texX2 = static_cast(srcX + width) / tw; - vertFill2D(mFloatTexArrayCached, mShortVertArrayCached, - texX1, texY1, texX2, texY2, - dstX, dstY, width, height); + vertFill2D(mFloatTexArrayCached, mShortVertArrayCached, + texX1, texY1, texX2, texY2, + dstX, dstY, width, height); - vp += 12; - if (vp >= vLimit) - { - completeCache(); - vp = 0; - } + vp += 12; + if (vp >= vLimit) + { + completeCache(); + vp = 0; } } -// } + } mVpCached = vp; } @@ -499,38 +495,35 @@ void MobileOpenGLGraphics::drawPatternInline(const Image *restrict const image, unsigned int vp = 0; const unsigned int vLimit = mMaxVertices * 4; // Draw a set of textured rectangles -// if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) -// { - const float texX1 = static_cast(srcX) / tw; - const float texY1 = static_cast(srcY) / th; + const float texX1 = static_cast(srcX) / tw; + const float texY1 = static_cast(srcY) / th; - for (int py = 0; py < h; py += ih) + for (int py = 0; py < h; py += ih) + { + const int height = (py + ih >= h) ? h - py : ih; + const float texY2 = static_cast(srcY + height) / th; + const int dstY = y + py; + for (int px = 0; px < w; px += iw) { - const int height = (py + ih >= h) ? h - py : ih; - const float texY2 = static_cast(srcY + height) / th; - const int dstY = y + py; - for (int px = 0; px < w; px += iw) - { - const int width = (px + iw >= w) ? w - px : iw; - const int dstX = x + px; + const int width = (px + iw >= w) ? w - px : iw; + const int dstX = x + px; - const float texX2 = static_cast(srcX + width) / tw; + const float texX2 = static_cast(srcX + width) / tw; - vertFill2D(mFloatTexArray, mShortVertArray, - texX1, texY1, texX2, texY2, - dstX, dstY, width, height); + vertFill2D(mFloatTexArray, mShortVertArray, + texX1, texY1, texX2, texY2, + dstX, dstY, width, height); - vp += 12; - if (vp >= vLimit) - { - drawTriangleArrayfs(vp); - vp = 0; - } + vp += 12; + if (vp >= vLimit) + { + drawTriangleArrayfs(vp); + vp = 0; } } - if (vp > 0) - drawTriangleArrayfs(vp); -// } + } + if (vp > 0) + drawTriangleArrayfs(vp); } void MobileOpenGLGraphics::drawRescaledPattern(const Image * @@ -568,49 +561,46 @@ void MobileOpenGLGraphics::drawRescaledPattern(const Image * const unsigned int vLimit = mMaxVertices * 4; // Draw a set of textured rectangles -// if (OpenGLImageHelper::mTextureType == GL_TEXTURE_2D) -// { - const float tw = static_cast(image->mTexWidth); - const float th = static_cast(image->mTexHeight); + const float tw = static_cast(image->mTexWidth); + const float th = static_cast(image->mTexHeight); - const float texX1 = static_cast(srcX) / tw; - const float texY1 = static_cast(srcY) / th; + const float texX1 = static_cast(srcX) / tw; + const float texY1 = static_cast(srcY) / th; - const float tFractionW = iw / tw; - const float tFractionH = ih / th; + const float tFractionW = iw / tw; + const float tFractionH = ih / th; - for (int py = 0; py < h; py += scaledHeight) + for (int py = 0; py < h; py += scaledHeight) + { + const int height = (py + scaledHeight >= h) + ? h - py : scaledHeight; + const int dstY = y + py; + const float visibleFractionH = static_cast(height) + / scaledHeight; + const float texY2 = texY1 + tFractionH * visibleFractionH; + for (int px = 0; px < w; px += scaledWidth) { - const int height = (py + scaledHeight >= h) - ? h - py : scaledHeight; - const int dstY = y + py; - const float visibleFractionH = static_cast(height) - / scaledHeight; - const float texY2 = texY1 + tFractionH * visibleFractionH; - for (int px = 0; px < w; px += scaledWidth) + const int width = (px + scaledWidth >= w) + ? w - px : scaledWidth; + const int dstX = x + px; + const float visibleFractionW = static_cast(width) + / scaledWidth; + const float texX2 = texX1 + tFractionW * visibleFractionW; + + vertFill2D(mFloatTexArray, mShortVertArray, + texX1, texY1, texX2, texY2, + dstX, dstY, width, height); + + vp += 12; + if (vp >= vLimit) { - const int width = (px + scaledWidth >= w) - ? w - px : scaledWidth; - const int dstX = x + px; - const float visibleFractionW = static_cast(width) - / scaledWidth; - const float texX2 = texX1 + tFractionW * visibleFractionW; - - vertFill2D(mFloatTexArray, mShortVertArray, - texX1, texY1, texX2, texY2, - dstX, dstY, width, height); - - vp += 12; - if (vp >= vLimit) - { - drawTriangleArrayfs(vp); - vp = 0; - } + drawTriangleArrayfs(vp); + vp = 0; } } - if (vp > 0) - drawTriangleArrayfs(vp); -// } + } + if (vp > 0) + drawTriangleArrayfs(vp); } inline void MobileOpenGLGraphics::drawVertexes(const diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index d86360059..2b6dd070b 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -975,12 +975,14 @@ Path Map::findPath(const int startX, const int startY, ++Gcost; } +/* // It costs extra to walk through a being (needs to be enough // to make it more attractive to walk around). -// if (occupied(x, y)) -// { -// Gcost += 3 * basicCost; -// } + if (occupied(x, y)) + { + Gcost += 3 * basicCost; + } +*/ // Skip if Gcost becomes too much // Warning: probably not entirely accurate diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index c67ec8a1c..ef0ef063e 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -363,12 +363,14 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->pixels); #ifdef DEBUG_OPENGL -// disabled for now, because debugger can't show it -// if (isGLNotNull(mglLabelObject)) -// { -// const char *const text = "image text"; -// mglLabelObject(GL_TEXTURE, texture, strlen(text), text); -// } +/* + disabled for now, because debugger can't show it + if (isGLNotNull(mglLabelObject)) + { + const char *const text = "image text"; + mglLabelObject(GL_TEXTURE, texture, strlen(text), text); + } +*/ #endif /* diff --git a/src/resources/safeopenglimagehelper.cpp b/src/resources/safeopenglimagehelper.cpp index 8376ae0c8..f43351d7c 100644 --- a/src/resources/safeopenglimagehelper.cpp +++ b/src/resources/safeopenglimagehelper.cpp @@ -360,12 +360,14 @@ Image *SafeOpenGLImageHelper::glLoad(SDL_Surface *tmpImage, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->pixels); #ifdef DEBUG_OPENGL -// disabled for now, because debugger can't show it -// if (isGLNotNull(mglLabelObject)) -// { -// const char *const text = "image text"; -// mglLabelObject(GL_TEXTURE, texture, strlen(text), text); -// } +/* + disabled for now, because debugger can't show it + if (isGLNotNull(mglLabelObject)) + { + const char *const text = "image text"; + mglLabelObject(GL_TEXTURE, texture, strlen(text), text); + } +*/ #endif /* diff --git a/src/sdl2gfx/SDL2_framerate.h b/src/sdl2gfx/SDL2_framerate.h index 1f5a70c85..45e153349 100644 --- a/src/sdl2gfx/SDL2_framerate.h +++ b/src/sdl2gfx/SDL2_framerate.h @@ -32,7 +32,8 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif /* --- */ diff --git a/src/sdl2gfx/SDL2_rotozoom.h b/src/sdl2gfx/SDL2_rotozoom.h index 72dde24a5..9a64d2a92 100644 --- a/src/sdl2gfx/SDL2_rotozoom.h +++ b/src/sdl2gfx/SDL2_rotozoom.h @@ -34,7 +34,8 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif #ifndef M_PI diff --git a/src/utils/xml/pugixml.cpp b/src/utils/xml/pugixml.cpp index db47ae588..e60012a9e 100644 --- a/src/utils/xml/pugixml.cpp +++ b/src/utils/xml/pugixml.cpp @@ -43,14 +43,16 @@ namespace XML { static void showErrorStatus(pugi::xml_parse_result &result) { -// switch (result.status) -// { -// case pugi::status_ok: -// break; -// case pugi::status_file_not_found: -// logger->log("xml error: %s", result.description()); -// break; -// } +/* + switch (result.status) + { + case pugi::status_ok: + break; + case pugi::status_file_not_found: + logger->log("xml error: %s", result.description()); + break; + } +*/ logger->log("xml error: %s", result.description()); } -- cgit v1.2.3-60-g2f50