diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-06-21 21:29:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-06-21 21:29:51 +0300 |
commit | f3a89322713a379678abc420d75230a9b17aa18f (patch) | |
tree | 1fa4318ba77eeef61272eb6cd982c7bf37b82800 | |
parent | 552867509d2a29d806d2ba416b24fbf7ac711803 (diff) | |
download | manaverse-f3a89322713a379678abc420d75230a9b17aa18f.tar.gz manaverse-f3a89322713a379678abc420d75230a9b17aa18f.tar.bz2 manaverse-f3a89322713a379678abc420d75230a9b17aa18f.tar.xz manaverse-f3a89322713a379678abc420d75230a9b17aa18f.zip |
fix code style.
41 files changed, 97 insertions, 140 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index 28d605a88..7a562c96e 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -80,7 +80,7 @@ extern QuitDialog *quitDialog; namespace ActionManager { -impHandler0(moveUp) +impHandler(moveUp) { if (NpcDialog *const dialog = NpcDialog::getActive()) { @@ -92,7 +92,7 @@ impHandler0(moveUp) return false; } -impHandler0(moveDown) +impHandler(moveDown) { if (NpcDialog *const dialog = NpcDialog::getActive()) { @@ -104,7 +104,7 @@ impHandler0(moveDown) return false; } -impHandler0(moveLeft) +impHandler(moveLeft) { if (outfitWindow && inputManager.isActionActive(Input::KEY_WEAR_OUTFIT)) { @@ -118,7 +118,7 @@ impHandler0(moveLeft) return false; } -impHandler0(moveRight) +impHandler(moveRight) { if (outfitWindow && inputManager.isActionActive(Input::KEY_WEAR_OUTFIT)) { diff --git a/src/beingequipbackend.cpp b/src/beingequipbackend.cpp index 170e676ef..392d23e0f 100644 --- a/src/beingequipbackend.cpp +++ b/src/beingequipbackend.cpp @@ -27,8 +27,7 @@ #include "debug.h" -BeingEquipBackend::BeingEquipBackend(Being *const being): - mBeing(being) +BeingEquipBackend::BeingEquipBackend(Being *const being) { memset(mEquipment, 0, sizeof(mEquipment)); if (being) diff --git a/src/beingequipbackend.h b/src/beingequipbackend.h index 8d2c6dbcc..af7002223 100644 --- a/src/beingequipbackend.h +++ b/src/beingequipbackend.h @@ -44,7 +44,6 @@ class BeingEquipBackend final : public Equipment::Backend private: Item *mEquipment[EQUIPMENT_SIZE]; - Being *mBeing; }; #endif // BEINGEQUIPBACKEND_H diff --git a/src/client.cpp b/src/client.cpp index 7b0756623..029c9c417 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -283,7 +283,9 @@ Client::Client(const Options &options) : mVideoButton(nullptr), mThemesButton(nullptr), mPerfomanceButton(nullptr), +#ifdef ANDROID mCloseButton(nullptr), +#endif mState(STATE_CHOOSE_SERVER), mOldState(STATE_START), mIcon(nullptr), @@ -2978,7 +2980,7 @@ void Client::windowRemoved(const Window *const window) inst->mCurrentDialog = nullptr; } -void Client::updateScreenKeyboard(int height A_UNUSED) +void Client::updateScreenKeyboard(int height) { instance()->mKeyboardHeight = height; } diff --git a/src/client.h b/src/client.h index 8110349c5..09b73bd9f 100644 --- a/src/client.h +++ b/src/client.h @@ -405,7 +405,9 @@ private: Button *mVideoButton; Button *mThemesButton; Button *mPerfomanceButton; +#ifdef ANDROID Button *mCloseButton; +#endif State mState; State mOldState; diff --git a/src/commands.cpp b/src/commands.cpp index 3d30e2169..c83001cc1 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -233,7 +233,7 @@ impHandler1(announce) Net::getAdminHandler()->announce(args); } -impHandler0(help) +impHandler2(help) { if (!helpWindow) return; @@ -480,7 +480,7 @@ impHandler0(present) chatWindow->doPresent(); } -impHandler1(ignore) +impHandler(ignore) { changeRelation(args, PlayerRelation::IGNORED, "ignored", tab); } diff --git a/src/game.cpp b/src/game.cpp index 177e24464..bfe3aa5e0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -377,11 +377,9 @@ static void destroyGuiWindows() Game *Game::mInstance = nullptr; Game::Game(): - mLastTarget(ActorSprite::UNKNOWN), mCurrentMap(nullptr), mMapName(""), mValidSpeed(true), - mLastAction(0), mNextAdjustTime(cur_time + adjustDelay), mAdjustLevel(0), mAdjustPerfomance(config.getBoolValue("adjustPerfomance")), diff --git a/src/game.h b/src/game.h index 1e8f242b0..6eb26f2dc 100644 --- a/src/game.h +++ b/src/game.h @@ -126,12 +126,9 @@ class Game final void clearKeysArray(); - int mLastTarget; - Map *mCurrentMap; std::string mMapName; bool mValidSpeed; - int mLastAction; LastKey mLastKeys[MAX_LASTKEYS]; unsigned mNextAdjustTime; int mAdjustLevel; diff --git a/src/graphics.h b/src/graphics.h index 79f25d684..f8a124a89 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -156,7 +156,7 @@ class Graphics : public gcn::SDLGraphics width, height, desiredWidth, desiredHeight, false); - }; + } /** * Draws a resclaled version of the image diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 05595fe89..1cb0a225d 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -77,10 +77,9 @@ class ChatInput final : public TextField { public: - ChatInput(ChatWindow *const window, TabbedArea *const tabs): + explicit ChatInput(ChatWindow *const window): TextField(window, "", false), mWindow(window), - mChatTabs(tabs), mFocusGaining(false) { setVisible(false); @@ -131,7 +130,6 @@ class ChatInput final : public TextField private: ChatWindow *mWindow; - TabbedArea *mChatTabs; bool mFocusGaining; }; @@ -196,7 +194,7 @@ ChatWindow::ChatWindow(): gcn::KeyListener(), mItemLinkHandler(new ItemLinkHandler), mChatTabs(new TabbedArea(this)), - mChatInput(new ChatInput(this, mChatTabs)), + mChatInput(new ChatInput(this)), mRainbowColor(0), mWhispers(), mHistory(), diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index 56aeb6129..17b89b9b6 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -122,7 +122,7 @@ void DidYouKnowWindow::action(const gcn::ActionEvent &event) } } -void DidYouKnowWindow::handleLink(const std::string &link A_UNUSED, +void DidYouKnowWindow::handleLink(const std::string &link, gcn::MouseEvent *event A_UNUSED) { if (strStartWith(link, "http://") || strStartWith(link, "https://")) diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 6d204ab91..e1472c822 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -97,7 +97,6 @@ KillStats::KillStats() : m15minExpNum(0), m15minSpeed(0), mJackoSpawnTime(0), - mValidateJackoTime(0), mJackoId(0), mIsJackoAlive(false), mIsJackoMustSpawn(true), diff --git a/src/gui/killstats.h b/src/gui/killstats.h index 02a7d1c9c..ea4d89582 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -121,7 +121,6 @@ class KillStats final : public Window, int m15minSpeed; int mJackoSpawnTime; - int mValidateJackoTime; int mJackoId; bool mIsJackoAlive; bool mIsJackoMustSpawn; diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index ca3f504ad..132419c91 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -86,7 +86,6 @@ OutfitWindow::OutfitWindow(): mBorderColor(getThemeColor(Theme::BORDER, 64)), mBackgroundColor(getThemeColor(Theme::BACKGROUND, 32)), mItemColors(), - mItemColorSelected(1), mItemClicked(false), mItemsUnequip() { diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h index b756b1e75..37d1b61a8 100644 --- a/src/gui/outfitwindow.h +++ b/src/gui/outfitwindow.h @@ -120,7 +120,6 @@ class OutfitWindow final : public Window, gcn::Color mBorderColor; gcn::Color mBackgroundColor; unsigned char mItemColors[OUTFITS_COUNT + 1][OUTFIT_ITEM_COUNT]; - unsigned char mItemColorSelected; bool mItemClicked; bool mItemsUnequip[OUTFITS_COUNT]; diff --git a/src/gui/questswindow.h b/src/gui/questswindow.h index 0d45881af..72fdb7bb6 100644 --- a/src/gui/questswindow.h +++ b/src/gui/questswindow.h @@ -39,9 +39,9 @@ class ExtendedListBox; class ItemLinkHandler; class Map; class ScrollArea; -class QuestEffect; class QuestsModel; +struct QuestEffect; struct QuestItem; typedef std::map<int, const QuestEffect*> NpcQuestEffectMap; diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp index a4ec0983a..a4de48807 100644 --- a/src/gui/registerdialog.cpp +++ b/src/gui/registerdialog.cpp @@ -279,7 +279,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) } } -void RegisterDialog::keyPressed(gcn::KeyEvent &keyEvent A_UNUSED) +void RegisterDialog::keyPressed(gcn::KeyEvent &keyEvent) { if (keyEvent.isConsumed()) { diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp index 59961f434..83020d1e1 100644 --- a/src/gui/setup_colors.cpp +++ b/src/gui/setup_colors.cpp @@ -70,17 +70,14 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : mRedLabel(new Label(this, _("Red:"))), mRedSlider(new Slider(0, 255)), mRedText(new TextField(this)), - mRedValue(0), // TRANSLATORS: colors tab. label. mGreenLabel(new Label(this, _("Green:"))), mGreenSlider(new Slider(0, 255)), mGreenText(new TextField(this)), - mGreenValue(0), // TRANSLATORS: colors tab. label. mBlueLabel(new Label(this, _("Blue:"))), mBlueSlider(new Slider(0, 255)), - mBlueText(new TextField(this)), - mBlueValue(0) + mBlueText(new TextField(this)) { // TRANSLATORS: settings colors tab name setName(_("Colors")); diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h index b3ad3a3e9..1e631663c 100644 --- a/src/gui/setup_colors.h +++ b/src/gui/setup_colors.h @@ -75,17 +75,14 @@ class Setup_Colors final : public SetupTab, Label *mRedLabel; Slider *mRedSlider; TextField *mRedText; - int mRedValue; Label *mGreenLabel; Slider *mGreenSlider; TextField *mGreenText; - int mGreenValue; Label *mBlueLabel; Slider *mBlueSlider; TextField *mBlueText; - int mBlueValue; static void setEntry(Slider *const s, TextField *const t, const int value); diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 83569416a..bdac7cca6 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -250,11 +250,10 @@ private: class SocialGuildTab2 final : public SocialTab, public gcn::ActionListener { public: - SocialGuildTab2(const Widget2 *const widget, - Guild *const guild, const bool showBackground) : + SocialGuildTab2(const Widget2 *const widget, Guild *const guild, + const bool showBackground) : SocialTab(widget), - gcn::ActionListener(), - mGuild(guild) + gcn::ActionListener() { // TRANSLATORS: tab in social window setCaption(_("Guild")); @@ -288,9 +287,6 @@ public: void action(const gcn::ActionEvent &event A_UNUSED) override { } - -private: - Guild *mGuild; }; class SocialPartyTab final : public SocialTab, public gcn::ActionListener diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 7b3703cfb..449196ed8 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -173,7 +173,6 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : gcn::ActionListener(), mIsMagicCommand(command->getCommandType() == TEXT_COMMAND_MAGIC), mCommand(command), - mAdvanced(false), // TRANSLATORS: command editor button mIsMagic(new RadioButton(this, _("magic"), "magic", mIsMagicCommand)), // TRANSLATORS: command editor button diff --git a/src/gui/textcommandeditor.h b/src/gui/textcommandeditor.h index c9308fe06..a145bf62c 100644 --- a/src/gui/textcommandeditor.h +++ b/src/gui/textcommandeditor.h @@ -70,7 +70,6 @@ class TextCommandEditor final : public Window, public gcn::ActionListener bool mIsMagicCommand; TextCommand *mCommand; - bool mAdvanced; RadioButton *mIsMagic; RadioButton *mIsOther; diff --git a/src/gui/textpopup.h b/src/gui/textpopup.h index 296cadb63..ce6ae2a02 100644 --- a/src/gui/textpopup.h +++ b/src/gui/textpopup.h @@ -58,7 +58,7 @@ class TextPopup final : public Popup { show(x, y, str1, static_cast<const char*>(""), static_cast<const char*>("")); - }; + } /** * Sets the text to be displayed. diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 867142c52..34a24e2aa 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -824,7 +824,7 @@ void Viewport::closePopupMenu() mPopupMenu->handleLink("cancel", nullptr); } -void Viewport::optionChanged(const std::string &name A_UNUSED) +void Viewport::optionChanged(const std::string &name) { if (name == "ScrollLaziness") mScrollLaziness = config.getIntValue("ScrollLaziness"); diff --git a/src/gui/widgets/characterviewnormal.cpp b/src/gui/widgets/characterviewnormal.cpp index 74cb0bdec..50dd8f7e4 100644 --- a/src/gui/widgets/characterviewnormal.cpp +++ b/src/gui/widgets/characterviewnormal.cpp @@ -32,7 +32,6 @@ CharacterViewNormal::CharacterViewNormal(CharSelectDialog *const widget, *const entries, const int padding) : CharacterViewBase(widget, padding), - mSelectedEntry(nullptr), mCharacterEntries(entries) { addKeyListener(widget); diff --git a/src/gui/widgets/characterviewnormal.h b/src/gui/widgets/characterviewnormal.h index d9b65d765..b8b8e1f7c 100644 --- a/src/gui/widgets/characterviewnormal.h +++ b/src/gui/widgets/characterviewnormal.h @@ -43,7 +43,6 @@ class CharacterViewNormal final : public CharacterViewBase void action(const gcn::ActionEvent &event A_UNUSED) override; private: - CharacterDisplay *mSelectedEntry; std::vector<CharacterDisplay*> *mCharacterEntries; }; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index cad16dde3..3ab9594fe 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -193,7 +193,6 @@ void ChatTab::chatLog(std::string line, Own own, lineColor = "##L"; break; default: - logger->log1("ChatTab::chatLog incorrect value in switch"); break; } diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 7f4846fce..997e1af7f 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -695,8 +695,6 @@ void ItemContainer::moveHighlight(const Direction direction) mHighlightedIndex += mGridColumns; break; default: - logger->log("warning moveHighlight unknown direction:" - + toString(static_cast<unsigned>(direction))); break; } } diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index 8cea612ab..fea5225d7 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -135,7 +135,7 @@ void PopupList::mousePressed(gcn::MouseEvent& mouseEvent) releaseModalFocus(); } -void PopupList::focusGained(const gcn::Event& event A_UNUSED) +void PopupList::focusGained(const gcn::Event& event) { const gcn::Widget *const source = event.getSource(); if (!mVisible || source == this || source == mListBox diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 0611b3714..947080762 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -54,7 +54,8 @@ void VertContainer::add2(gcn::Widget *const widget, const bool resizable, widget->setPosition(mLeftSpacing, mNextY); if (resizable) { - widget->setSize(mDimension.width - mLeftSpacing, mVerticalItemSize * 5); + widget->setSize(mDimension.width - mLeftSpacing, + mVerticalItemSize * 5); mResizableWidgets.push_back(widget); } else if (widget->getHeight() > mVerticalItemSize) diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 94937cac6..674fc171d 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -1019,7 +1019,10 @@ void Window::adjustPositionAfterResize(const int oldScreenWidth, if (mDimension.x > 0 && mDimension.x > rightMargin) mDimension.x = mainGraphics->mWidth - rightMargin - mDimension.width; if (mDimension.y > 0 && mDimension.y > bottomMargin) - mDimension.y = mainGraphics->mHeight - bottomMargin - mDimension.height; + { + mDimension.y = mainGraphics->mHeight + - bottomMargin - mDimension.height; + } ensureOnScreen(); } diff --git a/src/guichan/include/guichan/sdl/sdlpixel.hpp b/src/guichan/include/guichan/sdl/sdlpixel.hpp index c068aa290..4ec6b2386 100644 --- a/src/guichan/include/guichan/sdl/sdlpixel.hpp +++ b/src/guichan/include/guichan/sdl/sdlpixel.hpp @@ -84,10 +84,11 @@ namespace gcn break; case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) +#if SDL_BYTEORDER == SDL_BIG_ENDIAN color = p[0] << 16 | p[1] << 8 | p[2]; - else +#else color = p[0] | p[1] << 8 | p[2] << 16; +#endif break; case 4: @@ -142,18 +143,15 @@ namespace gcn break; case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - { - p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>((pixel) & 0xff); - } - else - { - p[0] = static_cast<uint8_t>((pixel) & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); - } +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>((pixel) & 0xff); +#else + p[0] = static_cast<uint8_t>((pixel) & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); +#endif break; case 4: @@ -256,24 +254,21 @@ namespace gcn break; case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - { - p[2] = static_cast<uint8_t>((p[2] * (255 - color.a) - + color.b * color.a) >> 8); - p[1] = static_cast<uint8_t>((p[1] * (255 - color.a) - + color.g * color.a) >> 8); - p[0] = static_cast<uint8_t>((p[0] * (255 - color.a) - + color.r * color.a) >> 8); - } - else - { - p[0] = static_cast<uint8_t>((p[0] * (255 - color.a) - + color.b * color.a) >> 8); - p[1] = static_cast<uint8_t>((p[1] * (255 - color.a) - + color.g * color.a) >> 8); - p[2] = static_cast<uint8_t>((p[2] * (255 - color.a) - + color.r * color.a) >> 8); - } +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + p[2] = static_cast<uint8_t>((p[2] * (255 - color.a) + + color.b * color.a) >> 8); + p[1] = static_cast<uint8_t>((p[1] * (255 - color.a) + + color.g * color.a) >> 8); + p[0] = static_cast<uint8_t>((p[0] * (255 - color.a) + + color.r * color.a) >> 8); +#else + p[0] = static_cast<uint8_t>((p[0] * (255 - color.a) + + color.b * color.a) >> 8); + p[1] = static_cast<uint8_t>((p[1] * (255 - color.a) + + color.g * color.a) >> 8); + p[2] = static_cast<uint8_t>((p[2] * (255 - color.a) + + color.r * color.a) >> 8); +#endif break; case 4: diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index 6fd7a15dc..b36b5e565 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -232,26 +232,23 @@ namespace gcn } case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + for (; x1 <= x2; ++x1) { - for (; x1 <= x2; ++x1) - { - p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>(pixel & 0xff); - p += 3; - } + p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>(pixel & 0xff); + p += 3; } - else +#else + for (; x1 <= x2; ++x1) { - for (; x1 <= x2; ++x1) - { - p[0] = static_cast<uint8_t>(pixel & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p += 3; - } + p[0] = static_cast<uint8_t>(pixel & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p += 3; } +#endif break; case 4: @@ -351,26 +348,23 @@ namespace gcn break; case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + for (; y1 <= y2; ++y1) { - for (; y1 <= y2; ++y1) - { - p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>(pixel & 0xff); - p += mTarget->pitch; - } + p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>(pixel & 0xff); + p += mTarget->pitch; } - else +#else + for (; y1 <= y2; ++y1) { - for (; y1 <= y2; ++y1) - { - p[0] = static_cast<uint8_t>(pixel & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p += mTarget->pitch; - } + p[0] = static_cast<uint8_t>(pixel & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p += mTarget->pitch; } +#endif break; case 4: diff --git a/src/mobileopenglgraphics.cpp b/src/mobileopenglgraphics.cpp index 4a8125e3e..aa08f7b67 100644 --- a/src/mobileopenglgraphics.cpp +++ b/src/mobileopenglgraphics.cpp @@ -528,8 +528,7 @@ inline void MobileOpenGLGraphics::drawVertexes(const for (iv = shortVertPool.begin(), ft = floatTexPool.begin(), ivp = vp.begin(); - iv != iv_end, ft != ft_end, - ivp != ivp_end; + iv != iv_end && ft != ft_end && ivp != ivp_end; ++ iv, ++ ft, ++ ivp) { drawTriangleArrayfs(*iv, *ft, *ivp); diff --git a/src/navigationmanager.h b/src/navigationmanager.h index b4ffbd400..155d83c9d 100644 --- a/src/navigationmanager.h +++ b/src/navigationmanager.h @@ -23,10 +23,11 @@ #include "localconsts.h" -class MetaTile; class Map; class Resource; +struct MetaTile; + class NavigationManager final { public: diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 59756e2c9..6761105e1 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -201,7 +201,7 @@ void GuildHandler::create(const std::string &name) const } void GuildHandler::invite(const int guildId A_UNUSED, - const std::string &name A_UNUSED) const + const std::string &name) const { if (!actorSpriteManager) return; diff --git a/src/net/tmwa/questhandler.cpp b/src/net/tmwa/questhandler.cpp index bb36ad820..378f53f97 100644 --- a/src/net/tmwa/questhandler.cpp +++ b/src/net/tmwa/questhandler.cpp @@ -67,7 +67,7 @@ void QuestHandler::handleMessage(Net::MessageIn &msg) BLOCK_END("QuestHandler::handleMessage") } -void QuestHandler::processSetQuestVar(Net::MessageIn &msg A_UNUSED) const +void QuestHandler::processSetQuestVar(Net::MessageIn &msg) const { const int var = msg.readInt16(); // variable const int val = msg.readInt32(); // value @@ -83,7 +83,7 @@ void QuestHandler::processSetQuestVar(Net::MessageIn &msg A_UNUSED) const } } -void QuestHandler::processPlayerQuests(Net::MessageIn &msg A_UNUSED) const +void QuestHandler::processPlayerQuests(Net::MessageIn &msg) const { const int count = (msg.readInt16() - 4) / 6; for (int f = 0; f < count; f ++) diff --git a/src/normalopenglgraphics.cpp b/src/normalopenglgraphics.cpp index af13d0a4f..74d8b4f63 100644 --- a/src/normalopenglgraphics.cpp +++ b/src/normalopenglgraphics.cpp @@ -651,8 +651,7 @@ inline void NormalOpenGLGraphics::drawVertexes(const for (iv = intVertPool.begin(), ft = floatTexPool.begin(), ivp = vp.begin(); - iv != iv_end, ft != ft_end, - ivp != ivp_end; + iv != iv_end && ft != ft_end && ivp != ivp_end; ++ iv, ++ ft, ++ ivp) { drawQuadArrayfi(*iv, *ft, *ivp); @@ -666,8 +665,7 @@ inline void NormalOpenGLGraphics::drawVertexes(const for (iv = intVertPool.begin(), it = intTexPool.begin(), ivp = vp.begin(); - iv != iv_end, it != it_end, - ivp != ivp_end; + iv != iv_end && it != it_end && ivp != ivp_end; ++ iv, ++ it, ++ ivp) { drawQuadArrayii(*iv, *it, *ivp); diff --git a/src/nullopenglgraphics.cpp b/src/nullopenglgraphics.cpp index a74a89a0b..ff3295485 100644 --- a/src/nullopenglgraphics.cpp +++ b/src/nullopenglgraphics.cpp @@ -553,8 +553,7 @@ inline void NullOpenGLGraphics::drawVertexes(const for (iv = intVertPool.begin(), ft = floatTexPool.begin(), ivp = vp.begin(); - iv != iv_end, ft != ft_end, - ivp != ivp_end; + iv != iv_end && ft != ft_end && ivp != ivp_end; ++ iv, ++ ft, ++ ivp) { drawQuadArrayfi(*iv, *ft, *ivp); @@ -568,8 +567,7 @@ inline void NullOpenGLGraphics::drawVertexes(const for (iv = intVertPool.begin(), it = intTexPool.begin(), ivp = vp.begin(); - iv != iv_end, it != it_end, - ivp != ivp_end; + iv != iv_end && it != it_end && ivp != ivp_end; ++ iv, ++ it, ++ ivp) { drawQuadArrayii(*iv, *it, *ivp); @@ -989,8 +987,8 @@ void NullOpenGLGraphics::drawPoint(int x A_UNUSED, int y A_UNUSED) restoreColor(); } -void NullOpenGLGraphics::drawLine(int x1 A_UNUSED, int y1 A_UNUSED, - int x2 A_UNUSED, int y2 A_UNUSED) +void NullOpenGLGraphics::drawLine(int x1, int y1, + int x2, int y2) { setTexturingAndBlending(false); restoreColor(); diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 881368fd3..337d1cb53 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -137,10 +137,7 @@ Image *SDLImageHelper::createTextSurface(SDL_Surface *const tmpImage, return nullptr; Image *img; - bool hasAlpha = false; - const bool converted = false; - const int sz = tmpImage->w * tmpImage->h; // The alpha channel to be filled with alpha values @@ -195,9 +192,6 @@ Image *SDLImageHelper::createTextSurface(SDL_Surface *const tmpImage, return nullptr; } - if (converted) - SDL_FreeSurface(tmpImage); - img = new Image(image, hasAlpha, alphaChannel); img->mAlpha = alpha; return img; diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index b090df6d9..8e0b03e1e 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -44,7 +44,7 @@ namespace XML Document::Document(const std::string &filename, const bool useResman) : mDoc(nullptr) { - int size; + int size = 0; char *data = nullptr; if (useResman) { |