diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/ambientlayer.cpp | 4 | ||||
-rw-r--r-- | src/resources/animation/animation.cpp | 4 | ||||
-rw-r--r-- | src/resources/atlas/atlasitem.h | 4 | ||||
-rw-r--r-- | src/resources/atlas/atlasresource.cpp | 4 | ||||
-rw-r--r-- | src/resources/atlas/textureatlas.h | 4 | ||||
-rw-r--r-- | src/resources/image.cpp | 4 | ||||
-rw-r--r-- | src/resources/imageset.cpp | 4 | ||||
-rw-r--r-- | src/resources/map/map.cpp | 4 | ||||
-rw-r--r-- | src/resources/map/mapheights.cpp | 2 | ||||
-rw-r--r-- | src/resources/map/maplayer.cpp | 4 | ||||
-rw-r--r-- | src/resources/map/objectslayer.h | 2 | ||||
-rw-r--r-- | src/resources/map/speciallayer.cpp | 4 | ||||
-rw-r--r-- | src/resources/map/tileset.h | 6 | ||||
-rw-r--r-- | src/resources/map/walklayer.cpp | 4 | ||||
-rw-r--r-- | src/resources/resource.h | 2 | ||||
-rw-r--r-- | src/resources/resourcemanager.cpp | 4 | ||||
-rw-r--r-- | src/resources/sdlmusic.cpp | 2 | ||||
-rw-r--r-- | src/resources/soundeffect.cpp | 4 | ||||
-rw-r--r-- | src/resources/sprite/spritedef.cpp | 10 | ||||
-rw-r--r-- | src/resources/subimage.cpp | 4 |
20 files changed, 38 insertions, 42 deletions
diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp index 389a2942d..3decec879 100644 --- a/src/resources/ambientlayer.cpp +++ b/src/resources/ambientlayer.cpp @@ -148,6 +148,6 @@ void AmbientLayer::draw(Graphics *const graphics, const int x, int AmbientLayer::calcMemoryLocal() const { - return sizeof(AmbientLayer) + - mName.capacity(); + return static_cast<int>(sizeof(AmbientLayer) + + mName.capacity()); } diff --git a/src/resources/animation/animation.cpp b/src/resources/animation/animation.cpp index 9c3361db5..6eac889ed 100644 --- a/src/resources/animation/animation.cpp +++ b/src/resources/animation/animation.cpp @@ -101,8 +101,8 @@ int Animation::calcMemoryLocal() const FOR_EACH (FramesCIter, it, mFrames) { const Frame &frame = *it; - sz += sizeof(Frame) + - frame.nextAction.capacity(); + sz += static_cast<int>(sizeof(Frame) + + frame.nextAction.capacity()); } return sz; } diff --git a/src/resources/atlas/atlasitem.h b/src/resources/atlas/atlasitem.h index 835d7faa8..039000393 100644 --- a/src/resources/atlas/atlasitem.h +++ b/src/resources/atlas/atlasitem.h @@ -45,8 +45,8 @@ struct AtlasItem final : public MemoryCounter int calcMemoryLocal() const override final { - return sizeof(AtlasItem) + - name.capacity(); + return static_cast<int>(sizeof(AtlasItem) + + name.capacity()); // +++ here need print, but not add to sum size of image } diff --git a/src/resources/atlas/atlasresource.cpp b/src/resources/atlas/atlasresource.cpp index 9ecc32692..48561bbbc 100644 --- a/src/resources/atlas/atlasresource.cpp +++ b/src/resources/atlas/atlasresource.cpp @@ -73,9 +73,9 @@ void AtlasResource::decRef() int AtlasResource::calcMemoryLocal() const { - return sizeof(AtlasResource) + + return static_cast<int>(sizeof(AtlasResource)) + Resource::calcMemoryLocal() + - atlases.capacity() * sizeof(TextureAtlas*); + static_cast<int>(atlases.capacity() * sizeof(TextureAtlas*)); } int AtlasResource::calcMemoryChilds(const int level) const diff --git a/src/resources/atlas/textureatlas.h b/src/resources/atlas/textureatlas.h index 7208a7bf8..78819fa00 100644 --- a/src/resources/atlas/textureatlas.h +++ b/src/resources/atlas/textureatlas.h @@ -56,8 +56,8 @@ struct TextureAtlas final : public MemoryCounter int calcMemoryLocal() const override final { - return sizeof(TextureAtlas) + - items.capacity() * sizeof(AtlasItem*); + return static_cast<int>(sizeof(TextureAtlas) + + items.capacity() * sizeof(AtlasItem*)); } int calcMemoryChilds(const int level) const override final diff --git a/src/resources/image.cpp b/src/resources/image.cpp index a537ebc75..c4bbf0a3c 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -477,8 +477,8 @@ void Image::SDLTerminateAlphaCache() int Image::calcMemoryLocal() const { // +++ this calculation can be wrong for SDL2 - int sz = sizeof(Image) + - sizeof(std::map<float, SDL_Surface*>) + + int sz = static_cast<int>(sizeof(Image) + + sizeof(std::map<float, SDL_Surface*>)) + Resource::calcMemoryLocal(); if (mSDLSurface) { diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index e20ad4eb4..e74ca3c07 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -78,7 +78,7 @@ Image* ImageSet::get(const size_type i) const int ImageSet::calcMemoryLocal() const { - return sizeof(ImageSet) + + return static_cast<int>(sizeof(ImageSet)) + Resource::calcMemoryLocal() + - mImages.capacity() * sizeof(Image); + static_cast<int>(mImages.capacity() * sizeof(Image)); } diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 51bd7952c..ee4e0dc59 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -1701,7 +1701,7 @@ void Map::updateConditionLayers() restrict2 int Map::calcMemoryLocal() const { - return sizeof(Map) + + return static_cast<int>(sizeof(Map) + mName.capacity() + sizeof(MetaTile) * mWidth * mHeight + sizeof(MapLayer*) * (mLayers.capacity() + @@ -1714,7 +1714,7 @@ int Map::calcMemoryLocal() const sizeof(ParticleEffectData) * mParticleEffects.capacity() + sizeof(MapItem) * mMapPortals.capacity() + (sizeof(TileAnimation) + sizeof(int)) * mTileAnimations.size() + - sizeof(Tileset*) * mIndexedTilesetsSize; + sizeof(Tileset*) * mIndexedTilesetsSize); } int Map::calcMemoryChilds(const int level) const diff --git a/src/resources/map/mapheights.cpp b/src/resources/map/mapheights.cpp index 5d5c30aa8..b785df72c 100644 --- a/src/resources/map/mapheights.cpp +++ b/src/resources/map/mapheights.cpp @@ -42,6 +42,6 @@ void MapHeights::setHeight(const int x, const int y, const uint8_t height) int MapHeights::calcMemoryLocal() const { - return sizeof(MapHeights) + + return static_cast<int>(sizeof(MapHeights)) + mWidth * mHeight; } diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 5d81cfb09..7ccf26396 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -749,9 +749,9 @@ void MapLayer::updateConditionTiles(MetaTile *const metaTiles, int MapLayer::calcMemoryLocal() const { - return sizeof(MapLayer) + + return static_cast<int>(sizeof(MapLayer) + sizeof(TileInfo) * mWidth * mHeight + - sizeof(MapRowVertexes) * mTempRows.capacity(); + sizeof(MapRowVertexes) * mTempRows.capacity()); } int MapLayer::calcMemoryChilds(const int level) const diff --git a/src/resources/map/objectslayer.h b/src/resources/map/objectslayer.h index 09573a627..57e5dc1ff 100644 --- a/src/resources/map/objectslayer.h +++ b/src/resources/map/objectslayer.h @@ -23,8 +23,6 @@ #include "resources/memorycounter.h" -#include <string> - #include "localconsts.h" class MapObjectList; diff --git a/src/resources/map/speciallayer.cpp b/src/resources/map/speciallayer.cpp index e57189d84..ddf5cc35e 100644 --- a/src/resources/map/speciallayer.cpp +++ b/src/resources/map/speciallayer.cpp @@ -154,6 +154,6 @@ void SpecialLayer::draw(Graphics *const graphics, int startX, int startY, int SpecialLayer::calcMemoryLocal() const { - return sizeof(SpecialLayer) + - sizeof(MapItem) * mWidth * mHeight; + return static_cast<int>(sizeof(SpecialLayer) + + sizeof(MapItem) * mWidth * mHeight); } diff --git a/src/resources/map/tileset.h b/src/resources/map/tileset.h index c2f4a297c..93ff16c2d 100644 --- a/src/resources/map/tileset.h +++ b/src/resources/map/tileset.h @@ -77,15 +77,15 @@ class Tileset final : public ImageSet int calcMemoryLocal() const override final { int sz = ImageSet::calcMemoryLocal() + - sizeof(Tileset); + static_cast<int>(sizeof(Tileset)); const std::map<std::string, std::string>::const_iterator it_end = mProperties.end(); std::map<std::string, std::string>::const_iterator it = mProperties.begin(); while (it != it_end) { - sz += (*it).first.capacity() + - (*it).second.capacity(); + sz += static_cast<int>((*it).first.capacity() + + (*it).second.capacity()); ++ it; } return sz; diff --git a/src/resources/map/walklayer.cpp b/src/resources/map/walklayer.cpp index 7bc505f18..a52f75179 100644 --- a/src/resources/map/walklayer.cpp +++ b/src/resources/map/walklayer.cpp @@ -46,6 +46,6 @@ int WalkLayer::getDataAt(const int x, const int y) const int WalkLayer::calcMemoryLocal() const { return Resource::calcMemoryLocal() + - sizeof(WalkLayer) + - sizeof(int) * mWidth * mHeight; + static_cast<int>(sizeof(WalkLayer) + + sizeof(int) * mWidth * mHeight); } diff --git a/src/resources/resource.h b/src/resources/resource.h index 4d9e03f2d..71e22b812 100644 --- a/src/resources/resource.h +++ b/src/resources/resource.h @@ -25,8 +25,6 @@ #include "resources/memorycounter.h" -#include <string> - #include "localconsts.h" /** diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 2b1c3450d..b4eea1299 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -1078,12 +1078,12 @@ int ResourceManager::calcMemoryChilds(const int level) const int sz = 0; FOR_EACH (ResourceCIterator, it, mResources) { - sz += (*it).first.capacity(); + sz += static_cast<int>((*it).first.capacity()); sz += (*it).second->calcMemory(level + 1); } FOR_EACH (ResourceCIterator, it, mOrphanedResources) { - sz += (*it).first.capacity(); + sz += static_cast<int>((*it).first.capacity()); sz += (*it).second->calcMemory(level + 1); } FOR_EACH (std::set<Resource*>::const_iterator, it, mDeletedResources) diff --git a/src/resources/sdlmusic.cpp b/src/resources/sdlmusic.cpp index 0360ef37b..5834e8b49 100644 --- a/src/resources/sdlmusic.cpp +++ b/src/resources/sdlmusic.cpp @@ -81,6 +81,6 @@ bool SDLMusic::play(const int loops, const int fadeIn) int SDLMusic::calcMemoryLocal() const { // +++ not used size of SDL_RWops - return sizeof(SDLMusic) + + return static_cast<int>(sizeof(SDLMusic)) + Resource::calcMemoryLocal(); } diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp index f817f9c44..4491e993a 100644 --- a/src/resources/soundeffect.cpp +++ b/src/resources/soundeffect.cpp @@ -60,7 +60,7 @@ bool SoundEffect::play(const int loops, const int volume, int SoundEffect::calcMemoryLocal() const { - return sizeof(SoundEffect) + - sizeof(SDL_AudioSpec) + + return static_cast<int>(sizeof(SoundEffect) + + sizeof(SDL_AudioSpec)) + Resource::calcMemoryLocal(); } diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp index e0919b10b..d0985860c 100644 --- a/src/resources/sprite/spritedef.cpp +++ b/src/resources/sprite/spritedef.cpp @@ -596,14 +596,14 @@ bool SpriteDef::addSequence(const int start, int SpriteDef::calcMemoryLocal() const { - int sz = sizeof(SpriteDef) + + int sz = static_cast<int>(sizeof(SpriteDef) + sizeof(ImageSets) + sizeof(Actions) + - sizeof(std::set<std::string>) + + sizeof(std::set<std::string>)) + Resource::calcMemoryLocal(); FOR_EACH (std::set<std::string>::const_iterator, it, mProcessedFiles) { - sz += (*it).capacity(); + sz += static_cast<int>((*it).capacity()); } return sz; } @@ -613,7 +613,7 @@ int SpriteDef::calcMemoryChilds(const int level) const int sz = 0; FOR_EACH (ImageSets::const_iterator, it, mImageSets) { - sz += (*it).first.capacity(); + sz += static_cast<int>((*it).first.capacity()); const ImageSet *const imageSet = (*it).second; sz += imageSet->calcMemory(level + 1); } @@ -623,7 +623,7 @@ int SpriteDef::calcMemoryChilds(const int level) const const ActionMap *const actionMap = (*it).second; FOR_EACHP (ActionMap::const_iterator, it2, actionMap) { - sz += (*it2).first.capacity(); + sz += static_cast<int>((*it2).first.capacity()); Action *const action = (*it2).second; sz += action->calcMemory(level + 1); } diff --git a/src/resources/subimage.cpp b/src/resources/subimage.cpp index 0652195dd..b6ec02479 100644 --- a/src/resources/subimage.cpp +++ b/src/resources/subimage.cpp @@ -225,8 +225,8 @@ void SubImage::decRef() int SubImage::calcMemoryLocal() const { - int sz = sizeof(SubImage) + - sizeof(std::map<float, SDL_Surface*>) + + int sz = static_cast<int>(sizeof(SubImage) + + sizeof(std::map<float, SDL_Surface*>)) + Resource::calcMemoryLocal(); return sz; } |