From f3850f2cf7f4428eed3be0efe9a7c440b9e4d950 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 20 Jul 2012 18:32:41 +0300 Subject: Fix code style. --- src/being.cpp | 7 +------ src/compoundsprite.cpp | 4 +--- src/gui/npcdialog.cpp | 4 ++-- src/gui/widgets/dropdown.cpp | 12 ++++++------ src/gui/widgets/dropdown.h | 2 +- src/logger.h | 2 +- src/resources/dye.cpp | 2 +- src/safeopenglgraphics.cpp | 11 ++++++----- src/utils/stringutils.h | 2 +- src/winver.h.in | 20 ++++++++++++++++++++ 10 files changed, 40 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/being.cpp b/src/being.cpp index 2f1555246..eddf44991 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -41,13 +41,8 @@ #include "sprite.h" #include "text.h" -#include "gui/buydialog.h" -#include "gui/buyselldialog.h" #include "gui/equipmentwindow.h" #include "gui/gui.h" -#include "gui/npcdialog.h" -#include "gui/npcpostdialog.h" -#include "gui/selldialog.h" #include "gui/socialwindow.h" #include "gui/speechbubble.h" #include "gui/theme.h" @@ -2672,7 +2667,7 @@ Gender Being::intToGender(uint8_t sex) int Being::getSpriteID(int slot) { - if (slot < 0 || (unsigned)slot >= mSpriteIDs.size()) + if (slot < 0 || static_cast(slot) >= mSpriteIDs.size()) return -1; return mSpriteIDs[slot]; diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index 91c8b16bc..a6f0c3d77 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -26,8 +26,7 @@ #include "graphics.h" #ifdef USE_OPENGL -#include "normalopenglgraphics.h" -#include "safeopenglgraphics.h" +#include "main.h" #endif #include "client.h" @@ -35,7 +34,6 @@ #include "resources/image.h" #include "resources/imagehelper.h" -#include "resources/openglimagehelper.h" #include "utils/dtor.h" diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 71a884d88..aa86ffeec 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -697,7 +697,7 @@ void NpcDialog::setAvatarAction(int actionId) { Being *being = mPlayerBox->getBeing(); if (being) - being->setAction((Being::Action)actionId); + being->setAction(static_cast(actionId)); } void NpcDialog::logic() @@ -706,7 +706,7 @@ void NpcDialog::logic() if (mShowAvatar && mAvatarBeing) { mAvatarBeing->logic(); - if (mPlayerBox->getWidth() < (signed)(3 * getPadding())) + if (mPlayerBox->getWidth() < static_cast(3 * getPadding())) { Sprite *sprite = mAvatarBeing->getSprite(0); if (sprite) diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 8b5f81e6b..a52f70926 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -45,7 +45,7 @@ int DropDown::instances = 0; Image *DropDown::buttons[2][2]; -ImageRect DropDown::skin; +ImageRect DropDown::skinRect; float DropDown::mAlpha = 1.0; static std::string const dropdownFiles[2] = @@ -96,7 +96,7 @@ DropDown::DropDown(gcn::ListModel *listModel, gcn::ActionListener* listener, // get the border skin if (Theme::instance()) - Theme::instance()->loadRect(skin, "dropdown_background.xml"); + Theme::instance()->loadRect(skinRect, "dropdown_background.xml"); } instances++; @@ -126,7 +126,7 @@ DropDown::~DropDown() } } if (Theme::instance()) - Theme::instance()->unloadRect(skin); + Theme::instance()->unloadRect(skinRect); } delete mScrollArea; mScrollArea = nullptr; @@ -152,8 +152,8 @@ void DropDown::updateAlpha() for (int a = 0; a < 9; a++) { - if (skin.grid[a]) - skin.grid[a]->setAlpha(mAlpha); + if (skinRect.grid[a]) + skinRect.grid[a]->setAlpha(mAlpha); } } } @@ -208,7 +208,7 @@ void DropDown::drawFrame(gcn::Graphics *graphics) const int w = getWidth() + bs * 2; const int h = getHeight() + bs * 2; - static_cast(graphics)->drawImageRect(0, 0, w, h, skin); + static_cast(graphics)->drawImageRect(0, 0, w, h, skinRect); } void DropDown::drawButton(gcn::Graphics *graphics) diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 5896042fa..c044e8a16 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -97,7 +97,7 @@ class DropDown : public gcn::DropDown // Add own Images. static int instances; static Image *buttons[2][2]; - static ImageRect skin; + static ImageRect skinRect; static float mAlpha; }; diff --git a/src/logger.h b/src/logger.h index 54b44cc0e..e05d1c2d6 100644 --- a/src/logger.h +++ b/src/logger.h @@ -72,7 +72,7 @@ class Logger */ void log(const char *log_text, ...) #ifdef __GNUC__ - __attribute__((__format__(__printf__, 2, 3))) + __attribute__((__format__(gnu_printf, 2, 3))) #endif ; diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index df26ec1b7..cfa796fec 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -51,7 +51,7 @@ DyePalette::DyePalette(const std::string &description, int8_t blockSize) {0, 0, 0, 0} }; - for (int i = 0, colorIdx = 0; i < blockSize && colorIdx < dyePalateSize; + for (int i = 0, colorIdx = 0; i < blockSize && colorIdx < 4; i +=2, colorIdx ++) { color.value[colorIdx] = static_cast(( diff --git a/src/safeopenglgraphics.cpp b/src/safeopenglgraphics.cpp index 37001f850..055a996d1 100644 --- a/src/safeopenglgraphics.cpp +++ b/src/safeopenglgraphics.cpp @@ -174,10 +174,10 @@ bool SafeOpenGLGraphics::drawImage2(const Image *image, int srcX, int srcY, } bool SafeOpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, - int dstX, int dstY, - int width, int height, - int desiredWidth, int desiredHeight, - bool useColor) + int dstX, int dstY, + int width, int height, + int desiredWidth, int desiredHeight, + bool useColor) { return drawRescaledImage(image, srcX, srcY, dstX, dstY, @@ -620,7 +620,8 @@ void SafeOpenGLGraphics::fillRectangle(const gcn::Rectangle& rect) drawRectangle(rect, true); } -void SafeOpenGLGraphics::setTargetPlane(int width A_UNUSED, int height A_UNUSED) +void SafeOpenGLGraphics::setTargetPlane(int width A_UNUSED, + int height A_UNUSED) { } diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index 917ea3ab6..92dddebea 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -93,7 +93,7 @@ std::string strprintf(char const *, ...) #ifdef __GNUC__ /* This attribute is nice: it even works through gettext invokation. For example, gcc will complain that strprintf(_("%s"), 42) is ill-formed. */ - __attribute__((__format__(__printf__, 1, 2))) + __attribute__((__format__(gnu_printf, 1, 2))) #endif ; diff --git a/src/winver.h.in b/src/winver.h.in index fb0aac2c0..1c727b135 100644 --- a/src/winver.h.in +++ b/src/winver.h.in @@ -1,3 +1,23 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + /* VERSION DEFINITIONS */ #define VER_MAJOR ${VER_MAJOR} #define VER_MINOR ${VER_MINOR} -- cgit v1.2.3-60-g2f50