summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-15 00:26:35 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-15 00:26:35 +0300
commitff516e9f60e9554e8938d04192a8e5ec9efb5647 (patch)
treeb134dd0202377c5b182f62870b983fe078700e28
parent269f642099ec8e4c6bcf735496c32ee8019aaf1b (diff)
downloadmv-ff516e9f60e9554e8938d04192a8e5ec9efb5647.tar.gz
mv-ff516e9f60e9554e8938d04192a8e5ec9efb5647.tar.bz2
mv-ff516e9f60e9554e8938d04192a8e5ec9efb5647.tar.xz
mv-ff516e9f60e9554e8938d04192a8e5ec9efb5647.zip
fix code style.
-rw-r--r--src/game.cpp3
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/gui/gui.h6
-rw-r--r--src/gui/viewport.cpp8
-rw-r--r--src/gui/viewport.h4
-rw-r--r--src/gui/widgets/desktop.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp4
-rw-r--r--src/gui/widgets/scrollarea.h4
-rw-r--r--src/gui/widgets/textbox.h2
-rw-r--r--src/gui/widgets/window.h2
-rw-r--r--src/gui/windows/buydialog.cpp10
-rw-r--r--src/gui/windows/charcreatedialog.cpp2
-rw-r--r--src/gui/windows/outfitwindow.cpp2
-rw-r--r--src/gui/windows/questswindow.cpp2
-rw-r--r--src/render/graphicsdef.hpp55
-rw-r--r--src/render/openglgraphicsdef.hpp2
-rw-r--r--src/resources/imagehelper.cpp5
-rw-r--r--src/resources/imagehelper.h3
-rw-r--r--src/resources/openglimagehelper.cpp3
-rw-r--r--src/resources/sdl2imagehelper.h12
-rw-r--r--src/resources/sdl2softwareimagehelper.h12
-rw-r--r--src/resources/surfaceimagehelper.h12
22 files changed, 65 insertions, 94 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 3eaddedfc..e30b7222e 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -620,6 +620,9 @@ void Game::slowLogic()
const int time = cur_time;
if (mTime != time)
{
+ if (valTest(Updated))
+ mValidSpeed = false;
+
mTime = time + 1;
if (botCheckerWindow)
botCheckerWindow->slowLogic();
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 554c1ff42..deed890ae 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -1234,7 +1234,7 @@ Widget* Gui::getKeyEventSource()
return widget;
}
-void Gui::distributeKeyEvent(KeyEvent& keyEvent)
+void Gui::distributeKeyEvent(KeyEvent& keyEvent) const
{
Widget* parent = keyEvent.getSource();
Widget* widget = keyEvent.getSource();
@@ -1437,7 +1437,7 @@ void Gui::handleModalFocusReleased()
}
}
-int Gui::getMousePressLength()
+int Gui::getMousePressLength() const
{
if (!mLastMousePressTimeStamp)
return 0;
diff --git a/src/gui/gui.h b/src/gui/gui.h
index f7c913752..8805f2518 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -302,10 +302,10 @@ class Gui final
*/
void removeGlobalKeyListener(KeyListener *const keyListener);
- bool isLongPress()
+ bool isLongPress() const
{ return getMousePressLength() > 250; }
- int getMousePressLength();
+ int getMousePressLength() const;
protected:
void handleMouseMoved(const MouseInput &mouseInput);
@@ -368,7 +368,7 @@ class Gui final
* @since 0.6.0
*/
- void distributeKeyEvent(KeyEvent& keyEvent);
+ void distributeKeyEvent(KeyEvent& keyEvent) const;
/**
* Distributes a key event to the global key listeners.
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 9b349c7f6..c2000b562 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -361,7 +361,7 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path,
}
}
-bool Viewport::openContextMenu(MouseEvent &event)
+bool Viewport::openContextMenu(const MouseEvent &event)
{
mPlayerFollowMouse = false;
const int eventX = event.getX();
@@ -440,7 +440,7 @@ bool Viewport::leftMouseAction()
Input::KEY_ATTACK)))
{
validateSpeed();
- if (player_node != mHoverBeing)
+ if (!mStatsReUpdated && player_node != mHoverBeing)
{
player_node->attack(mHoverBeing,
!inputManager.isActionActive(
@@ -452,7 +452,7 @@ bool Viewport::leftMouseAction()
Input::KEY_ATTACK)))
{
validateSpeed();
- if (player_node != mHoverBeing)
+ if (!mStatsReUpdated && player_node != mHoverBeing)
{
player_node->setGotoTarget(mHoverBeing);
return true;
@@ -543,7 +543,7 @@ void Viewport::mousePressed(MouseEvent &event)
}
}
-void Viewport::walkByMouse(MouseEvent &event)
+void Viewport::walkByMouse(const MouseEvent &event)
{
if (!mMap || !player_node)
return;
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 61fee37f8..c98350744 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -302,9 +302,9 @@ class Viewport final : public WindowContainer,
bool leftMouseAction();
- bool openContextMenu(MouseEvent &event);
+ bool openContextMenu(const MouseEvent &event);
- void walkByMouse(MouseEvent &event);
+ void walkByMouse(const MouseEvent &event);
/**
* Make the player go to the mouse position.
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 8504e7c2a..0ff1b17c9 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -201,7 +201,7 @@ void Desktop::setBestFittingWallpaper()
}
}
-void Desktop::handleLink(const std::string &link, MouseEvent *event)
+void Desktop::handleLink(const std::string &link, MouseEvent *event A_UNUSED)
{
if (link == "copyright")
inputManager.executeAction(Input::KEY_WINDOW_ABOUT);
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index e2421dc93..47b8b0985 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -509,7 +509,7 @@ void ScrollArea::calcButton(Graphics *const graphics,
}
}
-void ScrollArea::drawVBar(Graphics *const graphics)
+void ScrollArea::drawVBar(Graphics *const graphics) const
{
const Rect &dim = getVerticalBarDimension();
@@ -559,7 +559,7 @@ void ScrollArea::calcVBar(Graphics *const graphics)
}
}
-void ScrollArea::drawHBar(Graphics *const graphics)
+void ScrollArea::drawHBar(Graphics *const graphics) const
{
const Rect &dim = getHorizontalBarDimension();
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index 6a91ac0f8..0b0cae2c3 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -446,8 +446,8 @@ class ScrollArea final : public BasicContainer,
void drawButton(Graphics *const graphics, const BUTTON_DIR dir);
void calcButton(Graphics *const graphics, const BUTTON_DIR dir);
- void drawVBar(Graphics *const graphics);
- void drawHBar(Graphics *const graphics);
+ void drawVBar(Graphics *const graphics) const;
+ void drawHBar(Graphics *const graphics) const;
void drawVMarker(Graphics *const graphics);
void drawHMarker(Graphics *const graphics);
diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h
index 8de0fe0bf..e5cfbc7c9 100644
--- a/src/gui/widgets/textbox.h
+++ b/src/gui/widgets/textbox.h
@@ -255,7 +255,7 @@ class TextBox final : public Widget,
* @return True if the text box is opaque, false otherwise.
* @see setOpaque
*/
- bool isOpaque()
+ bool isOpaque() const
{ return mOpaque; }
/**
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 3a9bf2157..2c4ee5e5f 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -498,7 +498,7 @@ class Window : public BasicContainer2,
* @return The title bar height.
* @see setTitleBarHeight
*/
- unsigned int getTitleBarHeight()
+ unsigned int getTitleBarHeight() const
{ return mTitleBarHeight; }
/**
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 5ae15dfa7..86e819121 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -162,9 +162,9 @@ BuyDialog::BuyDialog() :
Window(_("Create items"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(-2),
mSortModel(nullptr),
mSortDropDown(nullptr),
+ mNpcId(-2),
mMoney(0),
mAmountItems(0),
mMaxItems(0),
@@ -178,9 +178,9 @@ BuyDialog::BuyDialog(const int npcId) :
Window(_("Buy"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
- mNpcId(npcId),
mSortModel(nullptr),
mSortDropDown(nullptr),
+ mNpcId(npcId),
mMoney(0),
mAmountItems(0),
mMaxItems(0),
@@ -194,13 +194,13 @@ BuyDialog::BuyDialog(std::string nick) :
Window(_("Buy"), false, nullptr, "buy.xml"),
ActionListener(),
SelectionListener(),
+ mSortModel(new SortListModelBuy),
+ mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")),
mNpcId(-1),
mMoney(0),
mAmountItems(0),
mMaxItems(0),
- mNick(nick),
- mSortModel(new SortListModelBuy),
- mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort"))
+ mNick(nick)
{
init();
}
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 6f48b3f41..1df282189 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -117,7 +117,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mCreateButton(new Button(this, _("Create"), "create", this)),
// TRANSLATORS: char create dialog button
mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
- mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(mRace),
+ mPlayer(new Being(0, ActorSprite::PLAYER, static_cast<uint16_t>(0U),
nullptr)),
mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml",
"charcreate_selectedplayerbox.xml")),
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index b78252bef..b1355ba46 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -68,7 +68,7 @@ OutfitWindow::OutfitWindow():
serverConfig.getValue("OutfitAwayIndex", OUTFITS_COUNT - 1))),
// TRANSLATORS: outfits window label
mKeyLabel(new Label(this, strprintf(_("Key: %s"),
- keyName(mCurrentOutfit).c_str()))),
+ keyName(0).c_str()))),
mBorderColor(getThemeColor(Theme::BORDER, 64)),
mBackgroundColor(getThemeColor(Theme::BACKGROUND, 32)),
mCurrentOutfit(0),
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp
index 0aaac9b96..8d4eae9c8 100644
--- a/src/gui/windows/questswindow.cpp
+++ b/src/gui/windows/questswindow.cpp
@@ -154,7 +154,7 @@ QuestsWindow::QuestsWindow() :
mText->setLinkHandler(mItemLinkHandler);
mTextScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
mQuestsListBox->setWidth(500);
- if (gui && gui->getNpcFont()->getHeight() < 20)
+ if (!gui || gui->getNpcFont()->getHeight() < 20)
mQuestsListBox->setRowHeight(20);
else
mQuestsListBox->setRowHeight(gui->getNpcFont()->getHeight());
diff --git a/src/render/graphicsdef.hpp b/src/render/graphicsdef.hpp
index bd9e80b37..80d3c7cf8 100644
--- a/src/render/graphicsdef.hpp
+++ b/src/render/graphicsdef.hpp
@@ -26,12 +26,12 @@ public:
* image for the inside.
*/
void drawImageRect(int x, int y,
- int w, int h,
- const ImageRect &imgRect);
+ int w, int h,
+ const ImageRect &imgRect);
bool drawNet(const int x1, const int y1,
- const int x2, const int y2,
- const int width, const int height) override final;
+ const int x2, const int y2,
+ const int width, const int height) override final;
void _beginDraw();
@@ -45,33 +45,33 @@ public:
* Draws a resclaled version of the image
*/
bool drawRescaledImage(const Image *const image,
- int dstX, int dstY,
- const int desiredWidth,
- const int desiredHeight) override final;
+ int dstX, int dstY,
+ const int desiredWidth,
+ const int desiredHeight) override final;
void drawPattern(const Image *const image,
- const int x, const int y,
- const int w, const int h) override final;
+ const int x, const int y,
+ const int w, const int h) override final;
void inline drawPatternInline(const Image *const image,
const int x, const int y,
const int w, const int h);
void drawRescaledPattern(const Image *const image,
- const int x, const int y,
- const int w, const int h,
- const int scaledWidth,
- const int scaledHeight) override final;
+ const int x, const int y,
+ const int w, const int h,
+ const int scaledWidth,
+ const int scaledHeight) override final;
void calcPattern(ImageVertexes *const vert,
- const Image *const image,
- const int x, const int y,
- const int w, const int h) const override final;
+ const Image *const image,
+ const int x, const int y,
+ const int w, const int h) const override final;
void calcPattern(ImageCollection *const vert,
- const Image *const image,
- const int x, const int y,
- const int w, const int h) const override final;
+ const Image *const image,
+ const int x, const int y,
+ const int w, const int h) const override final;
void calcTileVertexes(ImageVertexes *const vert,
const Image *const image,
@@ -83,7 +83,8 @@ public:
void drawTileVertexes(const ImageVertexes *const vert) override final;
- void drawTileCollection(const ImageCollection *const vertCol) override final;
+ void drawTileCollection(const ImageCollection
+ *const vertCol) override final;
void updateScreen() override final;
@@ -115,22 +116,22 @@ public:
const bool noFrame) override final;
bool drawImage(const Image *const image,
- int dstX, int dstY) override final;
+ int dstX, int dstY) override final;
void drawImageCached(const Image *const image,
- int x, int y) override final;
+ int x, int y) override final;
void drawPatternCached(const Image *const image,
- const int x, const int y,
- const int w, const int h) override final;
+ const int x, const int y,
+ const int w, const int h) override final;
void completeCache() override final;
private:
void inline calcImageRect(ImageVertexes *const vert,
- int x, int y,
- int w, int h,
- const ImageRect &imgRect);
+ int x, int y,
+ int w, int h,
+ const ImageRect &imgRect);
void inline calcPatternInline(ImageVertexes *const vert,
const Image *const image,
diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp
index c8937717b..4315d4115 100644
--- a/src/render/openglgraphicsdef.hpp
+++ b/src/render/openglgraphicsdef.hpp
@@ -36,7 +36,7 @@ public:
}
void drawRectangle(const Rect &rect,
- const bool filled);
+ const bool filled);
static void dumpSettings();
diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp
index 0fbc04776..d72550767 100644
--- a/src/resources/imagehelper.cpp
+++ b/src/resources/imagehelper.cpp
@@ -84,7 +84,7 @@ Image *ImageHelper::load(SDL_RWops *const rw, Dye const &dye) const
tmpImage, &rgba, SDL_SWSURFACE);
MSDL_FreeSurface(tmpImage);
- uint32_t *pixels = static_cast<uint32_t *>(surf->pixels);
+ uint32_t *const pixels = static_cast<uint32_t *const>(surf->pixels);
const int type = dye.getType();
switch (type)
@@ -203,7 +203,8 @@ SDL_Surface *ImageHelper::loadPng(SDL_RWops *const rw)
return nullptr;
}
-SDL_Surface *ImageHelper::create32BitSurface(int width, int height) const
+SDL_Surface *ImageHelper::create32BitSurface(int width,
+ int height) const
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int rmask = 0xff000000;
diff --git a/src/resources/imagehelper.h b/src/resources/imagehelper.h
index e7ec4cfad..f68d8c147 100644
--- a/src/resources/imagehelper.h
+++ b/src/resources/imagehelper.h
@@ -81,7 +81,8 @@ class ImageHelper
static void dumpSurfaceFormat(const SDL_Surface *const image);
- virtual SDL_Surface *create32BitSurface(int width, int height)
+ virtual SDL_Surface *create32BitSurface(int width,
+ int height)
const A_WARN_UNUSED;
static void setEnableAlpha(const bool n)
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 5a0a91fc1..262d839f7 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -290,7 +290,8 @@ void OpenGLImageHelper::initTextureSampler(const GLint id)
}
}
-SDL_Surface *OpenGLImageHelper::create32BitSurface(int width, int height) const
+SDL_Surface *OpenGLImageHelper::create32BitSurface(int width,
+ int height) const
{
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const int rmask = 0xff000000;
diff --git a/src/resources/sdl2imagehelper.h b/src/resources/sdl2imagehelper.h
index 44f81c433..296b50f8a 100644
--- a/src/resources/sdl2imagehelper.h
+++ b/src/resources/sdl2imagehelper.h
@@ -52,18 +52,6 @@ class SDLImageHelper final : public ImageHelper
{ }
/**
- * Loads an image from an SDL_RWops structure and recolors it.
- *
- * @param rw The SDL_RWops to load the image from.
- * @param dye The dye used to recolor the image.
- *
- * @return <code>NULL</code> if an error occurred, a valid pointer
- * otherwise.
- */
- Image *load(SDL_RWops *const rw,
- Dye const &dye) const override final A_WARN_UNUSED;
-
- /**
* Loads an image from an SDL surface.
*/
Image *load(SDL_Surface *const tmpImage) const
diff --git a/src/resources/sdl2softwareimagehelper.h b/src/resources/sdl2softwareimagehelper.h
index 01d6428b5..41af65fdb 100644
--- a/src/resources/sdl2softwareimagehelper.h
+++ b/src/resources/sdl2softwareimagehelper.h
@@ -52,18 +52,6 @@ class SDL2SoftwareImageHelper final : public ImageHelper
{ }
/**
- * Loads an image from an SDL_RWops structure and recolors it.
- *
- * @param rw The SDL_RWops to load the image from.
- * @param dye The dye used to recolor the image.
- *
- * @return <code>NULL</code> if an error occurred, a valid pointer
- * otherwise.
- */
- Image *load(SDL_RWops *const rw,
- Dye const &dye) const override final A_WARN_UNUSED;
-
- /**
* Loads an image from an SDL surface.
*/
Image *load(SDL_Surface *const tmpImage) const
diff --git a/src/resources/surfaceimagehelper.h b/src/resources/surfaceimagehelper.h
index b526c9b64..3e595009e 100644
--- a/src/resources/surfaceimagehelper.h
+++ b/src/resources/surfaceimagehelper.h
@@ -54,18 +54,6 @@ class SurfaceImageHelper final : public ImageHelper
{ }
/**
- * Loads an image from an SDL_RWops structure and recolors it.
- *
- * @param rw The SDL_RWops to load the image from.
- * @param dye The dye used to recolor the image.
- *
- * @return <code>NULL</code> if an error occurred, a valid pointer
- * otherwise.
- */
- Image *load(SDL_RWops *const rw,
- Dye const &dye) const override final A_WARN_UNUSED;
-
- /**
* Loads an image from an SDL surface.
*/
Image *load(SDL_Surface *const tmpImage) const