From 987a88ffb5bd00e7996e8267b2bd3c9ed48a40e2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 5 Sep 2012 00:53:33 +0300 Subject: another some const fixes. --- src/gui/sdlinput.cpp | 2 +- src/gui/sdlinput.h | 2 +- src/gui/theme.cpp | 2 +- src/gui/theme.h | 2 +- src/gui/userpalette.h | 2 +- src/gui/viewport.cpp | 2 +- src/gui/viewport.h | 2 +- src/gui/widgets/extendednamesmodel.cpp | 2 +- src/gui/widgets/extendednamesmodel.h | 2 +- src/gui/widgets/slider.cpp | 2 +- src/gui/widgets/slider.h | 2 +- src/resources/resourcemanager.cpp | 6 +++--- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 2c4e8cbea..ce59f47fd 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -236,7 +236,7 @@ int SDLInput::convertMouseButton(const int button) } } -int SDLInput::convertKeyCharacter(const SDL_Event event) +int SDLInput::convertKeyCharacter(const SDL_Event &event) { const SDL_keysym keysym = event.key.keysym; diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index db082ef2a..534f0573e 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -182,7 +182,7 @@ protected: * @return a key value. * @see Key */ - static int convertKeyCharacter(SDL_Event event); + static int convertKeyCharacter(const SDL_Event &event); std::queue mKeyInputQueue; std::queue mMouseInputQueue; diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 679b975e0..26f250c4c 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -60,7 +60,7 @@ static void initDefaultThemePath() defaultThemePath = "themes/"; } -Skin::Skin(const ImageRect skin, const ImageRect images, +Skin::Skin(const ImageRect &skin, const ImageRect &images, const std::string &filePath, const std::string &name, const int padding, const int titlePadding, std::map *const options): diff --git a/src/gui/theme.h b/src/gui/theme.h index 5498996dd..de027523d 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -42,7 +42,7 @@ class ProgressBar; class Skin { public: - Skin(const ImageRect skin, const ImageRect images, + Skin(const ImageRect &skin, const ImageRect &images, const std::string &filePath, const std::string &name = "", const int padding = 3, const int titlePadding = 4, std::map *const options = nullptr); diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index a808e865b..0ce3a6b85 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -117,7 +117,7 @@ class UserPalette : public Palette, public gcn::ListModel * @param type the color type requested * @param color the color that should be tested */ - inline void setTestColor(const int type, const gcn::Color color) + inline void setTestColor(const int type, const gcn::Color &color) { mColors[type].testColor = color; } /** diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 77bc7bb16..f521fde8c 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -348,7 +348,7 @@ void Viewport::_drawDebugPath(Graphics *const graphics) } void Viewport::_drawPath(Graphics *const graphics, const Path &path, - const gcn::Color color) const + const gcn::Color &color) const { graphics->setColor(color); diff --git a/src/gui/viewport.h b/src/gui/viewport.h index c83e83173..ec35ef3d6 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -292,7 +292,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener, * Draws the given path. */ void _drawPath(Graphics *const graphics, const Path &path, - const gcn::Color color = gcn::Color(255, 0, 0)) const; + const gcn::Color &color = gcn::Color(255, 0, 0)) const; /** * Make the player go to the mouse position. diff --git a/src/gui/widgets/extendednamesmodel.cpp b/src/gui/widgets/extendednamesmodel.cpp index 11c594321..083ce938e 100644 --- a/src/gui/widgets/extendednamesmodel.cpp +++ b/src/gui/widgets/extendednamesmodel.cpp @@ -51,7 +51,7 @@ std::string ExtendedNamesModel::getElementAt(int i) return mNames[i]; } -Image *ExtendedNamesModel::getImageAt(int i) +const Image *ExtendedNamesModel::getImageAt(int i) { if (i >= static_cast(mImages.size()) || i < 0) return nullptr; diff --git a/src/gui/widgets/extendednamesmodel.h b/src/gui/widgets/extendednamesmodel.h index 5a15949a9..be59c7e20 100644 --- a/src/gui/widgets/extendednamesmodel.h +++ b/src/gui/widgets/extendednamesmodel.h @@ -38,7 +38,7 @@ class ExtendedNamesModel : public ExtendedListModel virtual std::string getElementAt(int i); - virtual Image *getImageAt(int i); + virtual const Image *getImageAt(int i); StringVect &getNames() { return mNames; } diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index da6cb31f6..edc215b07 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -177,7 +177,7 @@ void Slider::draw(gcn::Graphics *graphics) drawMarker(graphics); } -void Slider::drawMarker(gcn::Graphics *const graphics) +void Slider::drawMarker(gcn::Graphics *const graphics) const { const Image *const img = (mHasMouse ? buttons[1].grid[HGRIP] : buttons[0].grid[HGRIP]); diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 7ef121346..95d23f83e 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -64,7 +64,7 @@ class Slider : public gcn::Slider /** * Draws the marker. */ - void drawMarker(gcn::Graphics *const graphics); + void drawMarker(gcn::Graphics *const graphics) const; /** * Called when the mouse enteres the widget area. diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 1edd7b6de..c06f9c181 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -585,7 +585,7 @@ ImageSet *ResourceManager::getSubImageSet(Image *const parent, if (!parent) return nullptr; - SubImageSetLoader rl = { this, parent, width, height }; + const SubImageSetLoader rl = { this, parent, width, height }; std::stringstream ss; ss << parent->getIdPath() << ", set[" << width << "x" << height << "]"; return static_cast(get(ss.str(), SubImageSetLoader::load, &rl)); @@ -620,7 +620,7 @@ Image *ResourceManager::getSubImage(Image *const parent, if (!parent) return nullptr; - SubImageLoader rl = { this, parent, x, y, width, height}; + const SubImageLoader rl = { this, parent, x, y, width, height}; std::stringstream ss; ss << parent->getIdPath() << ",[" << x << "," << y << "," @@ -885,7 +885,7 @@ Image *ResourceManager::getRescaled(Image *const image, std::string idPath = image->getIdPath() + strprintf( "_rescaled%dx%d", width, height); - RescaledLoader rl = { this, image, width, height }; + const RescaledLoader rl = { this, image, width, height }; Image *const img = static_cast( get(idPath, RescaledLoader::load, &rl)); return img; -- cgit v1.2.3-70-g09d2