summaryrefslogtreecommitdiff
path: root/src/resources/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-07 18:37:50 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-07 18:37:50 +0300
commit3dbdda0d3070a093f8a341f897ce4310a8b52bd2 (patch)
treeddb5a48767c97cbb95e8204acfeb667483477051 /src/resources/map
parent3173688b7c1a1027257aa057039bd50738ac8bb5 (diff)
downloadmanaverse-3dbdda0d3070a093f8a341f897ce4310a8b52bd2.tar.gz
manaverse-3dbdda0d3070a093f8a341f897ce4310a8b52bd2.tar.bz2
manaverse-3dbdda0d3070a093f8a341f897ce4310a8b52bd2.tar.xz
manaverse-3dbdda0d3070a093f8a341f897ce4310a8b52bd2.zip
Add some missing nonnull attributes to map/maplayer classes.
Diffstat (limited to 'src/resources/map')
-rw-r--r--src/resources/map/map.cpp6
-rw-r--r--src/resources/map/map.h12
-rw-r--r--src/resources/map/maplayer.h4
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;