diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-02-08 22:35:09 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-02-09 17:14:25 +0100 |
commit | 1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7 (patch) | |
tree | 74cff7036d1ecfb4df5a79a7ca68bedce5bea47e /src/resources/imageset.cpp | |
parent | 0ca05c54dd814f294617eda286ef175f01baa542 (diff) | |
download | mana-1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7.tar.gz mana-1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7.tar.bz2 mana-1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7.tar.xz mana-1b041ecccfbe44a4f50ffc086e3996e2b6eea4f7.zip |
C++11: Use default member initializers
This patch is not exhaustive.
Diffstat (limited to 'src/resources/imageset.cpp')
-rw-r--r-- | src/resources/imageset.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index 74b4034f..4eec23f8 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -29,8 +29,8 @@ ImageSet::ImageSet(Image *img, int width, int height, int margin, int spacing) : - mOffsetX(0), - mOffsetY(0) + mWidth(width), + mHeight(height) { for (int y = margin; y + height <= img->getHeight() - margin; y += height + spacing) { @@ -39,8 +39,6 @@ ImageSet::ImageSet(Image *img, int width, int height, mImages.push_back(img->getSubImage(x, y, width, height)); } } - mWidth = width; - mHeight = height; } ImageSet::~ImageSet() @@ -48,15 +46,13 @@ ImageSet::~ImageSet() delete_all(mImages); } -Image* ImageSet::get(size_type i) const +Image *ImageSet::get(size_type i) const { if (i >= mImages.size()) { logger->log("Warning: No sprite %d in this image set", (int) i); return nullptr; } - else - { - return mImages[i]; - } + + return mImages[i]; } |