From d83c6dd523827087681f019ebfca8798380dc968 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 20 Feb 2014 22:36:48 +0300 Subject: fix code style. --- src/being/being.h | 2 -- src/events/keyevent.h | 24 ++++++++++++------------ src/events/mouseevent.h | 18 +++++++++--------- src/gui/base/basiccontainer.cpp | 2 -- src/gui/base/gui.hpp | 7 ++++--- src/gui/base/widget.hpp | 2 -- src/gui/base/widgets/listbox.cpp | 2 ++ src/gui/base/widgets/listbox.hpp | 3 ++- src/gui/focushandler.h | 4 ++-- src/gui/popups/popupmenu.h | 10 ++++++---- src/gui/popups/spellpopup.cpp | 3 ++- src/gui/popups/spellpopup.h | 3 +-- src/gui/widgets/avatarlistbox.h | 2 ++ src/gui/widgets/colormodel.h | 6 +++++- src/gui/widgets/dropdown.h | 6 ------ src/gui/widgets/guitable.h | 1 - src/gui/widgets/itemlinkhandler.cpp | 2 ++ src/gui/widgets/label.h | 2 -- src/gui/widgets/listbox.h | 11 +++++++++++ src/gui/widgets/playerbox.h | 2 -- src/gui/widgets/popuplist.h | 7 +++++-- src/gui/widgets/setupitem.h | 3 --- src/gui/widgets/setuptouchitem.cpp | 2 +- src/gui/widgets/textfield.h | 2 -- src/gui/windows/botcheckerwindow.cpp | 10 +++++----- src/gui/windows/botcheckerwindow.h | 2 +- src/gui/windows/socialwindow.cpp | 10 +++++----- src/gui/windows/worldselectdialog.cpp | 2 ++ src/render/sdl2graphics.cpp | 1 + src/render/sdl2softwaregraphics.cpp | 1 + src/utils/files.cpp | 2 ++ src/utils/sdlpixel.h | 29 ++++++++++++++++------------- 32 files changed, 99 insertions(+), 84 deletions(-) diff --git a/src/being/being.h b/src/being/being.h index afa023068..4ef40d9fd 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -23,8 +23,6 @@ #ifndef BEING_BEING_H #define BEING_BEING_H -//#include "equipment.h" - #include "resources/beinginfo.h" #include diff --git a/src/events/keyevent.h b/src/events/keyevent.h index c0c950639..6ca3d87d8 100644 --- a/src/events/keyevent.h +++ b/src/events/keyevent.h @@ -103,19 +103,19 @@ class KeyEvent: public InputGuiEvent * @param key The key of the event. */ KeyEvent(gcn::Widget *const source, - const bool shiftPressed, - const bool controlPressed, - const bool altPressed, - const bool metaPressed, - const unsigned int type, - const bool numericPad, - const int actionId, - const Key &key) : + const bool shiftPressed, + const bool controlPressed, + const bool altPressed, + const bool metaPressed, + const unsigned int type, + const bool numericPad, + const int actionId, + const Key &key) : InputGuiEvent(source, - shiftPressed, - controlPressed, - altPressed, - metaPressed), + shiftPressed, + controlPressed, + altPressed, + metaPressed), mKey(key), #ifdef USE_SDL2 mText(), diff --git a/src/events/mouseevent.h b/src/events/mouseevent.h index 9378faac6..fc8088341 100644 --- a/src/events/mouseevent.h +++ b/src/events/mouseevent.h @@ -97,15 +97,15 @@ class MouseEvent: public InputGuiEvent * It's set to zero if another button is used. */ MouseEvent(gcn::Widget *const source, - const bool shiftPressed, - const bool controlPressed, - const bool altPressed, - const bool metaPressed, - const unsigned int type, - const unsigned int button, - const int x, - const int y, - const int clickCount) : + const bool shiftPressed, + const bool controlPressed, + const bool altPressed, + const bool metaPressed, + const unsigned int type, + const unsigned int button, + const int x, + const int y, + const int clickCount) : InputGuiEvent(source, shiftPressed, controlPressed, diff --git a/src/gui/base/basiccontainer.cpp b/src/gui/base/basiccontainer.cpp index edc465726..9f2806016 100644 --- a/src/gui/base/basiccontainer.cpp +++ b/src/gui/base/basiccontainer.cpp @@ -69,8 +69,6 @@ #include -#include "gui/focushandler.h" - #include "render/graphics.h" #include "debug.h" diff --git a/src/gui/base/gui.hpp b/src/gui/base/gui.hpp index 391a0520e..8c4ac4db0 100644 --- a/src/gui/base/gui.hpp +++ b/src/gui/base/gui.hpp @@ -67,13 +67,14 @@ #include #include -#include "events/keyevent.h" - -#include "input/mouseinput.h" +#include "localconsts.h" +class Event; class FocusHandler; class Graphics; +class KeyEvent; class KeyListener; +class MouseInput; class SDLInput; namespace gcn diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp index 6245d3c98..dd872d9a1 100644 --- a/src/gui/base/widget.hpp +++ b/src/gui/base/widget.hpp @@ -81,9 +81,7 @@ class FocusHandler; class FocusListener; class Font; class Graphics; -class KeyInput; class KeyListener; -class MouseInput; class MouseListener; class WidgetListener; diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index 02d94626c..765878834 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -69,6 +69,8 @@ #include "gui/font.h" +#include "gui/base/listmodel.hpp" + #include "listeners/selectionlistener.h" #include "debug.h" diff --git a/src/gui/base/widgets/listbox.hpp b/src/gui/base/widgets/listbox.hpp index ff2df395c..c46aca6ae 100644 --- a/src/gui/base/widgets/listbox.hpp +++ b/src/gui/base/widgets/listbox.hpp @@ -66,7 +66,6 @@ #include -#include "gui/base/listmodel.hpp" #include "gui/base/widget.hpp" #include "listeners/keylistener.h" @@ -76,6 +75,8 @@ class SelectionListener; namespace gcn { + class ListModel; + /** * An implementation of a list box where an item can be selected. * diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h index 0131a4c29..c8885ef2c 100644 --- a/src/gui/focushandler.h +++ b/src/gui/focushandler.h @@ -68,13 +68,13 @@ #include "gui/focushandler.h" -#include "events/event.h" - #include #include #include "localconsts.h" +class Event; + namespace gcn { class Widget; diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 70f8b7885..1ce274122 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -26,14 +26,11 @@ #include "gui/widgets/linkhandler.h" #include "gui/widgets/popup.h" -#include "being/actorsprite.h" - #include "listeners/actionlistener.h" -#include "gui/base/listmodel.hpp" - #include "localconsts.h" +class ActorSprite; class Being; class BrowserBox; class Button; @@ -48,6 +45,11 @@ class TextField; class ProgressBar; class Window; +namespace gcn +{ + class ListModel; +} + class RenameListener final : public ActionListener { public: diff --git a/src/gui/popups/spellpopup.cpp b/src/gui/popups/spellpopup.cpp index 8849a53cb..07bcc2330 100644 --- a/src/gui/popups/spellpopup.cpp +++ b/src/gui/popups/spellpopup.cpp @@ -23,7 +23,8 @@ #include "gui/popups/spellpopup.h" -#include "gui/font.h" +#include "textcommand.h" + #include "gui/gui.h" #include "gui/widgets/label.h" diff --git a/src/gui/popups/spellpopup.h b/src/gui/popups/spellpopup.h index 152dfb306..cbbd53703 100644 --- a/src/gui/popups/spellpopup.h +++ b/src/gui/popups/spellpopup.h @@ -26,9 +26,8 @@ #include "gui/widgets/popup.h" -#include "textcommand.h" - class Label; +class TextCommand; /** * A popup that displays information about an item. diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index 005ba7c72..e2ab3bf83 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -28,6 +28,8 @@ #include "gui/widgets/listbox.h" +#include "gui/base/listmodel.hpp" + #include class Image; diff --git a/src/gui/widgets/colormodel.h b/src/gui/widgets/colormodel.h index 4d29e24d3..c019d9aac 100644 --- a/src/gui/widgets/colormodel.h +++ b/src/gui/widgets/colormodel.h @@ -23,13 +23,17 @@ #include "utils/stringvector.h" -#include "gui/base/color.hpp" #include "gui/base/listmodel.hpp" #include "localconsts.h" class Widget2; +namespace gcn +{ + class Color; +} + struct ColorPair { ColorPair(const gcn::Color* c1, const gcn::Color* c2) : diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index a1908a3c6..9bb459d45 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -23,10 +23,7 @@ #ifndef GUI_WIDGETS_DROPDOWN_H #define GUI_WIDGETS_DROPDOWN_H -#include "gui/widgets/widget2.h" - #include "gui/base/basiccontainer.hpp" -//#include "gui/base/listmodel.hpp" #include "listeners/actionlistener.h" #include "listeners/focuslistener.h" @@ -37,10 +34,7 @@ #include "localconsts.h" class Image; -class ImageRect; -class ListBox; class PopupList; -class ScrollArea; class Skin; namespace gcn diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index d68e222ac..96f2a9532 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -26,7 +26,6 @@ #include "localconsts.h" #include "gui/widgets/tablemodel.h" -#include "gui/widgets/widget2.h" #include "listeners/keylistener.h" #include "listeners/mouselistener.h" diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 3e9a99a2a..2cf27ae30 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -48,6 +48,7 @@ namespace struct OpenUrlListener : public ActionListener { OpenUrlListener() : + ActionListener(), url() { } @@ -65,6 +66,7 @@ namespace } // namespace ItemLinkHandler::ItemLinkHandler() : + LinkHandler(), mItemPopup(new ItemPopup) { mItemPopup->postInit(); diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index b6adf9fba..b63c9b10e 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -22,8 +22,6 @@ #ifndef GUI_WIDGETS_LABEL_H #define GUI_WIDGETS_LABEL_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/label.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index f1ebee317..625f21085 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -23,12 +23,23 @@ #ifndef GUI_WIDGETS_LISTBOX_H #define GUI_WIDGETS_LISTBOX_H +#include "gui/base/color.hpp" + #include "gui/base/widgets/listbox.hpp" +#include "render/graphics.h" + #include "localconsts.h" class Skin; +class KeyEvent; +class MouseEvent; +class Widget2; +namespace gcn +{ + class ListModel; +} /** * A list box, meant to be used inside a scroll area. Same as the Guichan list * box except this one doesn't have a background, instead completely relying diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index d3fb4e5e3..7481dc9db 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_PLAYERBOX_H #define GUI_WIDGETS_PLAYERBOX_H -#include "gui/widgets/widget2.h" - #include "gui/base/widgets/scrollarea.hpp" #include "localconsts.h" diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h index 45f52d3b3..a495d7c46 100644 --- a/src/gui/widgets/popuplist.h +++ b/src/gui/widgets/popuplist.h @@ -25,14 +25,17 @@ #include "listeners/focuslistener.h" -#include "gui/base/listmodel.hpp" - #include "localconsts.h" class DropDown; class ListBox; class ScrollArea; +namespace gcn +{ + class ListModel; +} + class PopupList final : public Popup, public FocusListener { diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index 87b7c46f9..502d85d21 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -21,9 +21,6 @@ #ifndef GUI_WIDGETS_SETUPITEM_H #define GUI_WIDGETS_SETUPITEM_H -//#include "gui/widgets/button.h" -//#include "gui/widgets/tabs/setuptabscroll.h" - #include "gui/widgets/widget2.h" #include "listeners/actionlistener.h" diff --git a/src/gui/widgets/setuptouchitem.cpp b/src/gui/widgets/setuptouchitem.cpp index f4c213b2f..d50af8ff3 100644 --- a/src/gui/widgets/setuptouchitem.cpp +++ b/src/gui/widgets/setuptouchitem.cpp @@ -27,7 +27,7 @@ #include "gui/widgets/label.h" #include "gui/widgets/vertcontainer.h" -#include "gui/widgets/tabs/setuptabscroll.h" +#include "gui/widgets/tabs/setuptabscroll.h" #include diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index bfa721b7a..b05a498dc 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -23,8 +23,6 @@ #ifndef GUI_WIDGETS_TEXTFIELD_H #define GUI_WIDGETS_TEXTFIELD_H -#include "gui/widgets/widget2.h" - #include "listeners/focuslistener.h" #include "gui/base/widgets/textfield.hpp" diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index ade95eba5..3bdebff71 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -101,7 +101,7 @@ public: freeWidgets(); mPlayers.clear(); if (actorManager && botCheckerWindow - && botCheckerWindow->mEnabled) + && botCheckerWindow->mBotcheckerEnabled) { std::set beings = actorManager->getAll(); FOR_EACH (ActorSprites::iterator, i, beings) @@ -271,7 +271,7 @@ BotCheckerWindow::BotCheckerWindow(): mIncButton(new Button(this, _("Reset"), "reset", this)), mLastUpdateTime(0), mNeedUpdate(false), - mEnabled(false) + mBotcheckerEnabled(false) { const int w = 500; const int h = 250; @@ -346,7 +346,7 @@ BotCheckerWindow::BotCheckerWindow(): enableVisibleSound(true); config.addListener("enableBotCheker", this); - mEnabled = config.getBoolValue("enableBotCheker"); + mBotcheckerEnabled = config.getBoolValue("enableBotCheker"); } BotCheckerWindow::~BotCheckerWindow() @@ -358,7 +358,7 @@ BotCheckerWindow::~BotCheckerWindow() void BotCheckerWindow::slowLogic() { BLOCK_START("BotCheckerWindow::slowLogic") - if (mEnabled && mTableModel) + if (mBotcheckerEnabled && mTableModel) { const unsigned int nowTime = cur_time; if (nowTime - mLastUpdateTime > 5 && mNeedUpdate) @@ -417,7 +417,7 @@ void BotCheckerWindow::reset() void BotCheckerWindow::optionChanged(const std::string &name) { if (name == "enableBotCheker") - mEnabled = config.getBoolValue("enableBotCheker"); + mBotcheckerEnabled = config.getBoolValue("enableBotCheker"); } #ifdef USE_PROFILER diff --git a/src/gui/windows/botcheckerwindow.h b/src/gui/windows/botcheckerwindow.h index 25fd550fb..0c86b13b0 100644 --- a/src/gui/windows/botcheckerwindow.h +++ b/src/gui/windows/botcheckerwindow.h @@ -86,7 +86,7 @@ class BotCheckerWindow final : public Window, Button *mIncButton; int mLastUpdateTime; bool mNeedUpdate; - bool mEnabled; + bool mBotcheckerEnabled; }; extern BotCheckerWindow *botCheckerWindow; diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 52ddc9439..73098ee08 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -115,6 +115,11 @@ public: virtual void selectIndex(const unsigned num A_UNUSED) { } + virtual void buildCounter(const int online A_UNUSED = 0, + const int total A_UNUSED = 0) + { + } + protected: friend class SocialWindow; @@ -157,11 +162,6 @@ protected: socialWindow->setCounter(this, mCounterString); } - virtual void buildCounter(const int online A_UNUSED = 0, - const int total A_UNUSED = 0) - { - } - TextDialog *mInviteDialog; ConfirmDialog *mConfirmDialog; ScrollArea *mScroll; diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp index 3c7602a70..5acb11f93 100644 --- a/src/gui/windows/worldselectdialog.cpp +++ b/src/gui/windows/worldselectdialog.cpp @@ -33,6 +33,8 @@ #include "gui/widgets/listbox.h" #include "gui/widgets/scrollarea.h" +#include "gui/base/listmodel.hpp" + #include "net/loginhandler.h" #include "net/net.h" diff --git a/src/render/sdl2graphics.cpp b/src/render/sdl2graphics.cpp index 2cd7c965e..933120080 100644 --- a/src/render/sdl2graphics.cpp +++ b/src/render/sdl2graphics.cpp @@ -74,6 +74,7 @@ #include "graphicsvertexes.h" #include "logger.h" +#include "resources/image.h" #include "resources/imagehelper.h" #include "resources/sdl2imagehelper.h" diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp index 8efd73d68..e6cce9c35 100644 --- a/src/render/sdl2softwaregraphics.cpp +++ b/src/render/sdl2softwaregraphics.cpp @@ -31,6 +31,7 @@ #include "graphicsvertexes.h" #include "logger.h" +#include "resources/image.h" #include "resources/imagehelper.h" #include "resources/sdl2softwareimagehelper.h" diff --git a/src/utils/files.cpp b/src/utils/files.cpp index 11ac222f5..d671cb0db 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -22,6 +22,8 @@ #if defined(ANDROID) || defined(__native_client__) #include "resources/resourcemanager.h" + +#include "utils/mkdir.h" #endif #include "utils/physfstools.h" diff --git a/src/utils/sdlpixel.h b/src/utils/sdlpixel.h index 692615688..a01858831 100644 --- a/src/utils/sdlpixel.h +++ b/src/utils/sdlpixel.h @@ -80,14 +80,14 @@ inline void SDLputPixel(SDL_Surface* surface, int x, int y, if (!surface) return; - int bpp = surface->format->BytesPerPixel; + const int bpp = surface->format->BytesPerPixel; SDL_LockSurface(surface); - Uint8 *p = static_cast(surface->pixels) + Uint8 *const p = static_cast(surface->pixels) + y * surface->pitch + x * bpp; - Uint32 pixel = SDL_MapRGB(surface->format, + const Uint32 pixel = SDL_MapRGB(surface->format, static_cast(color.r), static_cast(color.g), static_cast(color.b)); @@ -131,13 +131,14 @@ inline void SDLputPixel(SDL_Surface* surface, int x, int y, * @param dst the destination color. * @param a alpha. */ -inline unsigned int SDLAlpha32(unsigned int src, unsigned int dst, - unsigned char a) +inline unsigned int SDLAlpha32(const unsigned int src, + const unsigned int dst, + const unsigned char a) { - unsigned int b = ((src & 0xff) * a + (dst & 0xff) * (255 - a)) >> 8; - unsigned int g = ((src & 0xff00) * a + (dst & 0xff00) + const unsigned int b = ((src & 0xff) * a + (dst & 0xff) * (255 - a)) >> 8; + const unsigned int g = ((src & 0xff00) * a + (dst & 0xff00) * (255 - a)) >> 8; - unsigned int r = ((src & 0xff0000) * a + (dst & 0xff0000) + const unsigned int r = ((src & 0xff0000) * a + (dst & 0xff0000) * (255 - a)) >> 8; return (b & 0xff) | (g & 0xff00) | (r & 0xff0000); @@ -150,8 +151,10 @@ inline unsigned int SDLAlpha32(unsigned int src, unsigned int dst, * @param dst the destination color. * @param a alpha. */ -inline unsigned short SDLAlpha16(unsigned short src, unsigned short dst, - unsigned char a, const SDL_PixelFormat *f) +inline unsigned short SDLAlpha16(const unsigned short src, + const unsigned short dst, + const unsigned char a, + const SDL_PixelFormat *const f) { unsigned int b = ((src & f->Rmask) * a + (dst & f->Rmask) * (255 - a)) >> 8; @@ -174,14 +177,14 @@ inline unsigned short SDLAlpha16(unsigned short src, unsigned short dst, inline void SDLputPixelAlpha(SDL_Surface* surface, int x, int y, const gcn::Color& color) { - int bpp = surface->format->BytesPerPixel; + const int bpp = surface->format->BytesPerPixel; SDL_LockSurface(surface); - Uint8 *p = static_cast(surface->pixels) + Uint8 *const p = static_cast(surface->pixels) + y * surface->pitch + x * bpp; - Uint32 pixel = SDL_MapRGB(surface->format, + const Uint32 pixel = SDL_MapRGB(surface->format, static_cast(color.r), static_cast(color.g), static_cast(color.b)); -- cgit v1.2.3-60-g2f50