From c70be70cab3615cb36cc5f244671cf5d39f1fda8 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 9 Feb 2024 09:47:21 +0100 Subject: General code cleanups * Removing unused includes * Use member initialization * Use range-based for loops * Use nullptr * Removed no longer used aliases * Use override * Don't use else after return * Use '= delete' to remove implicit members * Use std::string::empty instead of comparing to "" --- src/resources/image.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/resources/image.h') diff --git a/src/resources/image.h b/src/resources/image.h index 66c3ff78..662c0393 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -38,7 +38,6 @@ #endif class Dye; -class Position; /** * Defines a class for loading and storing images. @@ -87,7 +86,7 @@ class Image : public Resource /** * Tells is the image is loaded */ - bool isLoaded() + bool isLoaded() const { return mLoaded; } /** @@ -164,8 +163,8 @@ class Image : public Resource // ----------------------- SDL_Rect mBounds; - bool mLoaded; - float mAlpha; + bool mLoaded = false; + float mAlpha = 1.0f; // ----------------------- // SDL protected members @@ -177,7 +176,7 @@ class Image : public Resource /** SDL_Surface to SDL_Texture Image loader */ static Image *_SDLload(SDL_Surface *tmpImage); - SDL_Texture *mTexture; + SDL_Texture *mTexture = nullptr; /** Stores whether the transparency is disabled */ static bool mDisableTransparency; @@ -201,7 +200,7 @@ class Image : public Resource static Image *_GLload(SDL_Surface *image); - GLuint mGLImage; + GLuint mGLImage = 0; int mTexWidth, mTexHeight; static bool mUseOpenGL; -- cgit v1.2.3-70-g09d2