diff options
Diffstat (limited to 'src/resources/map')
-rw-r--r-- | src/resources/map/map.cpp | 6 | ||||
-rw-r--r-- | src/resources/map/map.h | 12 | ||||
-rw-r--r-- | src/resources/map/maplayer.h | 4 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index b2697ddcf..ada25e3d6 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -163,8 +163,6 @@ Map::~Map() config.removeListeners(this); CHECKLISTENERS - delete [] mMetaTiles; - if (mWalkLayer) { mWalkLayer->decRef(); @@ -186,6 +184,7 @@ Map::~Map() mAtlas = nullptr; } delete2(mHeights); + delete [] mMetaTiles; } void Map::optionChanged(const std::string &restrict value) restrict2 @@ -298,9 +297,6 @@ void Map::addLayer(MapLayer *const layer) restrict2 void Map::addTileset(Tileset *const tileset) restrict2 { - if (!tileset) - return; - mTilesets.push_back(tileset); const int height = tileset->getHeight(); if (height > mMaxTileHeight) diff --git a/src/resources/map/map.h b/src/resources/map/map.h index 3ffedc3de..61d328313 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -125,12 +125,12 @@ class Map final : public Properties, public ConfigListener /** * Adds a layer to this map. The map takes ownership of the layer. */ - void addLayer(MapLayer *const layer) restrict2; + void addLayer(MapLayer *const layer) restrict2 A_NONNULL(2); /** * Adds a tileset to this map. The map takes ownership of the tileset. */ - void addTileset(Tileset *const tileset) restrict2; + void addTileset(Tileset *const tileset) restrict2 A_NONNULL(2); /** * Finds the tile set that a tile with the given global id is part of. @@ -229,7 +229,8 @@ class Map final : public Properties, public ConfigListener * Adds a tile animation to the map */ void addAnimation(const int gid, - TileAnimation *restrict const animation) restrict2; + TileAnimation *restrict const animation) restrict2 + A_NONNULL(3); void setDrawLayersFlags(const MapTypeT &restrict n) restrict2; @@ -348,7 +349,8 @@ class Map final : public Properties, public ConfigListener void setWalkLayer(WalkLayer *restrict const layer) restrict2 noexcept { mWalkLayer = layer; } - void addHeights(const MapHeights *restrict const heights) restrict2; + void addHeights(const MapHeights *restrict const heights) restrict2 + A_NONNULL(2); uint8_t getHeightOffset(const int x, const int y) const restrict2; @@ -368,7 +370,7 @@ class Map final : public Properties, public ConfigListener /** * Adds an actor to the map. */ - Actors::iterator addActor(Actor *const actor) restrict2; + Actors::iterator addActor(Actor *const actor) restrict2 A_NONNULL(2); /** * Removes an actor from the map. diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h index b4aec3ac3..45dcaec02 100644 --- a/src/resources/map/maplayer.h +++ b/src/resources/map/maplayer.h @@ -165,11 +165,11 @@ class MapLayer final: public ConfigListener protected: static int getTileDrawWidth(const TileInfo *restrict img, const int endX, - int &width) A_WARN_UNUSED; + int &width) A_WARN_UNUSED A_NONNULL(1); void updateConditionTiles(MetaTile *restrict const metaTiles, const int width, - const int height) restrict; + const int height) restrict A_NONNULL(2); private: const int mX; |