diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-08 00:17:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-08 00:17:45 +0300 |
commit | 593cccb16074fe9269dd2f278bd79859769eb1fd (patch) | |
tree | d8b3d93001021c59622ea88140dbbef8aee05013 /src/resources | |
parent | b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2 (diff) | |
download | mv-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.gz mv-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.bz2 mv-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.xz mv-593cccb16074fe9269dd2f278bd79859769eb1fd.zip |
Improve constructors in some classes.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/colordb.h | 8 | ||||
-rw-r--r-- | src/resources/image.cpp | 11 | ||||
-rw-r--r-- | src/resources/imageset.cpp | 1 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 3 | ||||
-rw-r--r-- | src/resources/music.cpp | 1 | ||||
-rw-r--r-- | src/resources/soundeffect.h | 1 | ||||
-rw-r--r-- | src/resources/spritedef.h | 3 |
7 files changed, 17 insertions, 11 deletions
diff --git a/src/resources/colordb.h b/src/resources/colordb.h index fd479d00a..4be6503fb 100644 --- a/src/resources/colordb.h +++ b/src/resources/colordb.h @@ -40,11 +40,11 @@ namespace ColorDB { } ItemColor(const int id0, const std::string &name0, - const std::string &color0) + const std::string &color0) : + id(id0), + name(name0), + color(color0) { - this->id = id0; - this->name = name0; - this->color = color0; } int id; diff --git a/src/resources/image.cpp b/src/resources/image.cpp index e70ee3de5..0e2423bf9 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -45,6 +45,8 @@ Image::Image(SDL_Surface *const image, const bool hasAlphaChannel0, uint8_t *const alphaChannel) : + Resource(), + mLoaded(false), mAlpha(1.0f), mHasAlphaChannel(hasAlphaChannel0), mSDLSurface(image), @@ -61,8 +63,6 @@ Image::Image(SDL_Surface *const image, const bool hasAlphaChannel0, mBounds.x = 0; mBounds.y = 0; - mLoaded = false; - if (mSDLSurface) { mBounds.w = static_cast<uint16_t>(mSDLSurface->w); @@ -82,6 +82,8 @@ Image::Image(SDL_Surface *const image, const bool hasAlphaChannel0, #ifdef USE_OPENGL Image::Image(const GLuint glimage, const int width, const int height, const int texWidth, const int texHeight) : + Resource(), + mLoaded(false), mAlpha(1.0f), mHasAlphaChannel(true), mSDLSurface(nullptr), @@ -104,9 +106,8 @@ Image::Image(const GLuint glimage, const int width, const int height, } else { - logger->log( - "Image::Image(GLuint*, ...): Couldn't load invalid Surface!"); - mLoaded = false; + logger->log("Image::Image(GLuint*, ...):" + " Couldn't load invalid Surface!"); } } #endif diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index 538b27c84..2e10f74a2 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -32,6 +32,7 @@ ImageSet::ImageSet(Image *const img, const int width, const int height, const int margin, const int spacing) : + Resource(), mWidth(width), mHeight(height), mOffsetX(0), diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index e72893d12..7e106af80 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -82,7 +82,8 @@ ItemInfo::ItemInfo() : mColors(nullptr), mColorList(""), mHitEffectId(0), - mCriticalHitEffectId(0) + mCriticalHitEffectId(0), + maxFloorOffset(32) { for (int f = 0; f < 10; f ++) { diff --git a/src/resources/music.cpp b/src/resources/music.cpp index 1b66e6bad..d88b3ccac 100644 --- a/src/resources/music.cpp +++ b/src/resources/music.cpp @@ -27,6 +27,7 @@ #include "debug.h" Music::Music(Mix_Music *const music) : + Resource(), mMusic(music) { } diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h index 5f3676064..7d23dcca0 100644 --- a/src/resources/soundeffect.h +++ b/src/resources/soundeffect.h @@ -66,6 +66,7 @@ class SoundEffect : public Resource * Constructor. */ SoundEffect(Mix_Chunk *const soundEffect) : + Resource(), mChunk(soundEffect) { } diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 86f2d7f12..74960f64e 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -143,7 +143,8 @@ class SpriteDef : public Resource /** * Constructor. */ - SpriteDef() + SpriteDef() : + Resource() { } /** |