diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-02 12:47:35 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-02 12:47:35 +0300 |
commit | 7f9d948a34c0afeb2fbf3e663d058048248b622f (patch) | |
tree | e39b895cf4b6fd8391474f139e794751dd28ae52 | |
parent | 05f6f3e94abc5c1e1801d62100cef494e2711474 (diff) | |
download | plus-7f9d948a34c0afeb2fbf3e663d058048248b622f.tar.gz plus-7f9d948a34c0afeb2fbf3e663d058048248b622f.tar.bz2 plus-7f9d948a34c0afeb2fbf3e663d058048248b622f.tar.xz plus-7f9d948a34c0afeb2fbf3e663d058048248b622f.zip |
Add missing const and static into resource classes.
-rw-r--r-- | src/resources/imagehelper.cpp | 2 | ||||
-rw-r--r-- | src/resources/imagehelper.h | 2 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 6 | ||||
-rw-r--r-- | src/resources/iteminfo.h | 6 | ||||
-rw-r--r-- | src/resources/openglimagehelper.cpp | 2 | ||||
-rw-r--r-- | src/resources/openglimagehelper.h | 2 | ||||
-rw-r--r-- | src/resources/resourcemanager.cpp | 8 | ||||
-rw-r--r-- | src/resources/resourcemanager.h | 13 | ||||
-rw-r--r-- | src/resources/spritedef.cpp | 12 | ||||
-rw-r--r-- | src/resources/spritedef.h | 16 |
10 files changed, 41 insertions, 28 deletions
diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp index a089dc248..ff7c196c4 100644 --- a/src/resources/imagehelper.cpp +++ b/src/resources/imagehelper.cpp @@ -94,7 +94,7 @@ SDL_Surface* ImageHelper::convertTo32Bit(SDL_Surface *const tmpImage) return MSDL_ConvertSurface(tmpImage, &RGBAFormat, SDL_SWSURFACE); } -void ImageHelper::dumpSurfaceFormat(const SDL_Surface *const image) const +void ImageHelper::dumpSurfaceFormat(const SDL_Surface *const image) { if (image->format) { diff --git a/src/resources/imagehelper.h b/src/resources/imagehelper.h index 27cf1df14..2e3b96771 100644 --- a/src/resources/imagehelper.h +++ b/src/resources/imagehelper.h @@ -82,7 +82,7 @@ class ImageHelper static SDL_Surface *convertTo32Bit(SDL_Surface *const tmpImage) A_WARN_UNUSED; - void dumpSurfaceFormat(const SDL_Surface *const image) const; + static void dumpSurfaceFormat(const SDL_Surface *const image); virtual SDL_Surface *create32BitSurface(int width, int height) const A_WARN_UNUSED = 0; diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index afe9ff027..b7fc0f4ac 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -253,8 +253,10 @@ const SpriteToItemMap *ItemInfo::getSpriteToItemReplaceMap(const int direction) return nullptr; } -void ItemInfo::setSpriteOrder(int *const ptr, const int direction, - const int n, const int def) const +void ItemInfo::setSpriteOrder(int *const ptr, + const int direction, + const int n, + const int def) { switch (direction) { diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 43dcbf9e9..d3df1c448 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -229,8 +229,10 @@ class ItemInfo final void setDrawPriority(const int direction, const int n); - void setSpriteOrder(int *const ptr, const int direction, - const int n, const int def = -1) const; + static void setSpriteOrder(int *const ptr, + const int direction, + const int n, + const int def = -1); const std::map<int, int> &getTags() const A_WARN_UNUSED { return mTags; } diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index d855323d1..5a0a91fc1 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -110,7 +110,7 @@ Image *OpenGLImageHelper::createTextSurface(SDL_Surface *const tmpImage, return img; } -int OpenGLImageHelper::powerOfTwo(const int input) const +int OpenGLImageHelper::powerOfTwo(const int input) { int value; if (mTextureType == GL_TEXTURE_2D) diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h index 6c6492eb4..2f203a00a 100644 --- a/src/resources/openglimagehelper.h +++ b/src/resources/openglimagehelper.h @@ -123,7 +123,7 @@ class OpenGLImageHelper final : public ImageHelper /** * Returns the first power of two equal or bigger than the input. */ - int powerOfTwo(const int input) const A_WARN_UNUSED; + static int powerOfTwo(const int input) A_WARN_UNUSED; Image *glLoad(SDL_Surface *tmpImage, int width = 0, int height = 0) const A_WARN_UNUSED; diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 4cc7a4574..954930b64 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -399,7 +399,7 @@ bool ResourceManager::exists(const std::string &path) const return PhysFs::exists(path.c_str()); } -bool ResourceManager::existsLocal(const std::string &path) const +bool ResourceManager::existsLocal(const std::string &path) { bool flg(false); std::fstream file; @@ -415,7 +415,7 @@ bool ResourceManager::isDirectory(const std::string &path) const return PhysFs::isDirectory(path.c_str()); } -std::string ResourceManager::getPath(const std::string &file) const +std::string ResourceManager::getPath(const std::string &file) { // get the real path to the file const char *const tmp = PhysFs::getRealDir(file.c_str()); @@ -982,7 +982,7 @@ void *ResourceManager::loadFile(const std::string &fileName, int &fileSize) } bool ResourceManager::copyFile(const std::string &restrict src, - const std::string &restrict dst) const + const std::string &restrict dst) { PHYSFS_file *const srcFile = PhysFs::openRead(src.c_str()); if (!srcFile) @@ -1054,7 +1054,7 @@ bool ResourceManager::loadTextFileLocal(const std::string &fileName, void ResourceManager::saveTextFile(std::string path, const std::string &restrict name, - const std::string &restrict text) const + const std::string &restrict text) { if (!mkdir_r(path.c_str())) { diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index 72cad5988..2398cf212 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -122,7 +122,7 @@ class ResourceManager final /** * Checks whether the given file or directory exists */ - bool existsLocal(const std::string &path) const A_WARN_UNUSED; + static bool existsLocal(const std::string &path) A_WARN_UNUSED; /** * Checks whether the given path is a directory. @@ -136,7 +136,7 @@ class ResourceManager final * @param file The file to get the real path to. * @return The real path. */ - std::string getPath(const std::string &file) const A_WARN_UNUSED; + static std::string getPath(const std::string &file) A_WARN_UNUSED; /** * Creates a resource and adds it to the resource map. @@ -184,8 +184,8 @@ class ResourceManager final * @return true on success, false on failure. An error message should be * in the log file. */ - bool copyFile(const std::string &restrict src, - const std::string &restrict dst) const; + static bool copyFile(const std::string &restrict src, + const std::string &restrict dst); /** * Convenience wrapper around ResourceManager::get for loading @@ -274,8 +274,9 @@ class ResourceManager final static bool loadTextFileLocal(const std::string &fileName, StringVect &lines); - void saveTextFile(std::string path, const std::string &restrict name, - const std::string &restrict text) const; + static void saveTextFile(std::string path, + const std::string &restrict name, + const std::string &restrict text); Image *getRescaled(Image *const image, const int width, const int height) A_WARN_UNUSED; diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index e37aa1aa8..5265a1a96 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -493,12 +493,16 @@ void SpriteDef::addAction(const unsigned hp, const std::string &name, (*mActions[hp])[name] = action; } -bool SpriteDef::addSequence(const int start, const int end, const int delay, - const int offsetX, const int offsetY, +bool SpriteDef::addSequence(const int start, + const int end, + const int delay, + const int offsetX, + const int offsetY, const int variant_offset, - int repeat, const int rand, + int repeat, + const int rand, const ImageSet *const imageSet, - Animation *const animation) const + Animation *const animation) { if (!imageSet || !animation) return true; diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index ecedde507..b9f5d2b19 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -159,12 +159,16 @@ class SpriteDef final : public Resource void addAction(const unsigned hp, const std::string &name, Action *const action); - bool addSequence(const int start, const int end, const int delay, - const int offsetX, const int offsetY, - const int variant_offset, - int repeat, const int rand, - const ImageSet *const imageSet, - Animation *const animation) const; + static bool addSequence(const int start, + const int end, + const int delay, + const int offsetX, + const int offsetY, + const int variant_offset, + int repeat, + const int rand, + const ImageSet *const imageSet, + Animation *const animation); private: /** |