summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-23 21:29:47 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-23 21:29:47 +0300
commit90132a83c309b5ae0c699e4fbbb7c62656321301 (patch)
tree9bd6bbac6df7cfcd67d30535d30ef1b8bd25ab3f
parent9c1e1e3c8af21342da1bdf616a800ff373cad433 (diff)
downloadmv-90132a83c309b5ae0c699e4fbbb7c62656321301.tar.gz
mv-90132a83c309b5ae0c699e4fbbb7c62656321301.tar.bz2
mv-90132a83c309b5ae0c699e4fbbb7c62656321301.tar.xz
mv-90132a83c309b5ae0c699e4fbbb7c62656321301.zip
Fix code style.
-rw-r--r--src/gui/widgets/browserbox.cpp3
-rw-r--r--src/gui/widgets/browserbox_unittest.cc1
-rw-r--r--src/resources/iteminfo.cpp3
-rw-r--r--src/resources/sdlgfxblitfunc.cpp19
-rw-r--r--src/resources/sdlgfxblitfunc.h4
-rw-r--r--src/resources/sdlmusic.cpp3
-rw-r--r--src/resources/sdlmusic.h3
-rw-r--r--src/utils/browserboxtools.cpp8
8 files changed, 23 insertions, 21 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 592283910..fc8406546 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -168,7 +168,6 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
{
std::string tmp = row;
std::string newRow;
- size_t idx1;
const Font *const font = getFont();
int linksCount = 0;
@@ -193,7 +192,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
BrowserBoxTools::replaceKeys(tmp);
}
- idx1 = tmp.find("@@");
+ size_t idx1 = tmp.find("@@");
while (idx1 != std::string::npos)
{
const size_t idx2 = tmp.find('|', idx1);
diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc
index e32eaa68a..6bcc91110 100644
--- a/src/gui/widgets/browserbox_unittest.cc
+++ b/src/gui/widgets/browserbox_unittest.cc
@@ -161,6 +161,7 @@ TEST_CASE("BrowserBox tests", "browserbox")
row = "11|22<####>";
box->addRow(row);
row = "11|22##><##";
+ box->addRow(row);
row = "%%@@11|22@@";
box->addRow(row);
row = "%%2@@11|22@@";
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 8a142ec4d..6c8840f75 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -31,10 +31,9 @@
#include "resources/db/colordb.h"
#include "resources/db/itemdb.h"
-#include "configuration.h"
-
#include "utils/checkutils.h"
#include "utils/dtor.h"
+#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/resources/sdlgfxblitfunc.cpp b/src/resources/sdlgfxblitfunc.cpp
index d7bc956f2..97a6e7bc4 100644
--- a/src/resources/sdlgfxblitfunc.cpp
+++ b/src/resources/sdlgfxblitfunc.cpp
@@ -332,7 +332,7 @@ namespace
};
} // namespace
-static void _SDL_gfxBlitBlitterRGBA(SDL_gfxBlitInfo *info)
+static void _SDL_gfxBlitBlitterRGBA(const SDL_gfxBlitInfo *const info)
{
const int width = info->d_width;
int height = info->d_height;
@@ -388,10 +388,10 @@ static void _SDL_gfxBlitBlitterRGBA(SDL_gfxBlitInfo *info)
}
}
-static int _SDL_gfxBlitRGBACall(SDL_Surface *const src,
- SDL_Rect *const srcrect,
- SDL_Surface *const dst,
- SDL_Rect *const dstrect)
+static int _SDL_gfxBlitRGBACall(const SDL_Surface *const src,
+ const SDL_Rect *const srcrect,
+ const SDL_Surface *const dst,
+ const SDL_Rect *const dstrect)
{
/*
* Set up source and destination buffer pointers, then blit
@@ -433,9 +433,9 @@ static int _SDL_gfxBlitRGBACall(SDL_Surface *const src,
}
int SDLgfxBlitRGBA(SDL_Surface *const src,
- SDL_Rect *const srcrect,
+ const SDL_Rect *const srcrect,
SDL_Surface *const dst,
- SDL_Rect *const dstrect)
+ const SDL_Rect *const dstrect)
{
SDL_Rect sr;
SDL_Rect dr;
@@ -447,7 +447,8 @@ int SDLgfxBlitRGBA(SDL_Surface *const src,
/*
* Make sure the surfaces aren't locked
*/
- if ((src == nullptr) || (dst == nullptr))
+ if (src == nullptr ||
+ dst == nullptr)
{
reportAlways("SDLgfxBlitRGBA: passed a NULL surface");
return -1;
@@ -499,7 +500,7 @@ int SDLgfxBlitRGBA(SDL_Surface *const src,
/*
* Clip the destination rectangle against the clip rectangle
*/
- SDL_Rect *clip = &dst->clip_rect;
+ const SDL_Rect *const clip = &dst->clip_rect;
int dx;
int dy;
diff --git a/src/resources/sdlgfxblitfunc.h b/src/resources/sdlgfxblitfunc.h
index 5060e3552..77a0d1e42 100644
--- a/src/resources/sdlgfxblitfunc.h
+++ b/src/resources/sdlgfxblitfunc.h
@@ -35,8 +35,8 @@ struct SDL_Rect;
// src surface can be any format (most time 32 bit surface with any masks)
// dst surface always correct 32 sufraces (shared format for all)
int SDLgfxBlitRGBA(SDL_Surface *const src,
- SDL_Rect *const srcrect,
+ const SDL_Rect *const srcrect,
SDL_Surface *const dst,
- SDL_Rect *const dstrect);
+ const SDL_Rect *const dstrect);
#endif // RESOURCE_SDLGFXBLITFUNC_H
diff --git a/src/resources/sdlmusic.cpp b/src/resources/sdlmusic.cpp
index 4d604c8cb..d3801d453 100644
--- a/src/resources/sdlmusic.cpp
+++ b/src/resources/sdlmusic.cpp
@@ -57,7 +57,8 @@ SDLMusic::~SDLMusic()
#endif // USE_SDL2
}
-bool SDLMusic::play(const int loops, const int fadeIn)
+bool SDLMusic::play(const int loops,
+ const int fadeIn) const
{
if (fadeIn > 0)
return Mix_FadeInMusicPos(mMusic, loops, fadeIn, 0.0) != 0;
diff --git a/src/resources/sdlmusic.h b/src/resources/sdlmusic.h
index 44262b840..70614c420 100644
--- a/src/resources/sdlmusic.h
+++ b/src/resources/sdlmusic.h
@@ -66,7 +66,8 @@ class SDLMusic final : public Resource
* @return <code>true</code> if the playback started properly
* <code>false</code> otherwise.
*/
- bool play(const int loops = -1, const int fadeIn = 0);
+ bool play(const int loops = -1,
+ const int fadeIn = 0) const;
int calcMemoryLocal() const override final;
diff --git a/src/utils/browserboxtools.cpp b/src/utils/browserboxtools.cpp
index e3045c9ee..a8c2b6b3f 100644
--- a/src/utils/browserboxtools.cpp
+++ b/src/utils/browserboxtools.cpp
@@ -85,7 +85,7 @@ std::string BrowserBoxTools::replaceLinkCommands(const std::string &link)
{ // monster link
const BeingTypeId id = static_cast<BeingTypeId>(
atoi(link.substr(1).c_str()));
- BeingInfo *info = MonsterDB::get(id);
+ BeingInfo *const info = MonsterDB::get(id);
if (info != nullptr)
data = info->getName();
}
@@ -93,7 +93,7 @@ std::string BrowserBoxTools::replaceLinkCommands(const std::string &link)
{ // pet link
const BeingTypeId id = static_cast<BeingTypeId>(
atoi(link.substr(1).c_str()));
- BeingInfo *info = PETDB::get(id);
+ BeingInfo *const info = PETDB::get(id);
if (info != nullptr)
data = info->getName();
}
@@ -101,7 +101,7 @@ std::string BrowserBoxTools::replaceLinkCommands(const std::string &link)
{ // homunculus link
const BeingTypeId id = static_cast<BeingTypeId>(
atoi(link.substr(1).c_str()));
- BeingInfo *info = HomunculusDB::get(id);
+ BeingInfo *const info = HomunculusDB::get(id);
if (info != nullptr)
data = info->getName();
}
@@ -109,7 +109,7 @@ std::string BrowserBoxTools::replaceLinkCommands(const std::string &link)
{ // mercenary link
const BeingTypeId id = static_cast<BeingTypeId>(
atoi(link.substr(1).c_str()));
- BeingInfo *info = MercenaryDB::get(id);
+ BeingInfo *const info = MercenaryDB::get(id);
if (info != nullptr)
data = info->getName();
}