diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-08-19 09:12:54 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2017-08-19 09:12:54 +0200 |
commit | b5f7249a7edc25077d84b27b38552228b92ff763 (patch) | |
tree | 26770c25680cc0aebb9d252f8b9d91f5e07ba78a /src/mapblock.h | |
parent | e53d8a75360944a494a56269fc328871cb0a60cc (diff) | |
download | hax-minetest-server-b5f7249a7edc25077d84b27b38552228b92ff763.tar.gz hax-minetest-server-b5f7249a7edc25077d84b27b38552228b92ff763.zip |
Code modernization: src/m* (part 2)
* empty function
* default constructor/destructor
* remove unused Map::emergeSector(a,b)
* for range-based loops
* migrate a dirs[7] table to direction tables
* remove various old unused function
Diffstat (limited to 'src/mapblock.h')
-rw-r--r-- | src/mapblock.h | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/mapblock.h b/src/mapblock.h index 84991631d..83f13f302 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -255,7 +255,7 @@ public: *valid_position = isValidPosition(x, y, z); if (!*valid_position) - return MapNode(CONTENT_IGNORE); + return {CONTENT_IGNORE}; return data[z * zstride + y * ystride + x]; } @@ -292,8 +292,8 @@ public: inline MapNode getNodeNoCheck(s16 x, s16 y, s16 z, bool *valid_position) { *valid_position = data != nullptr; - if (!valid_position) - return MapNode(CONTENT_IGNORE); + if (!*valid_position) + return {CONTENT_IGNORE}; return data[z * zstride + y * ystride + x]; } @@ -456,12 +456,12 @@ public: //// Node Timers //// - inline NodeTimer getNodeTimer(v3s16 p) + inline NodeTimer getNodeTimer(const v3s16 &p) { return m_node_timers.get(p); } - inline void removeNodeTimer(v3s16 p) + inline void removeNodeTimer(const v3s16 &p) { m_node_timers.remove(p); } @@ -640,31 +640,16 @@ inline bool blockpos_over_max_limit(v3s16 p) /* Returns the position of the block where the node is located */ -inline v3s16 getNodeBlockPos(v3s16 p) -{ - return getContainerPos(p, MAP_BLOCKSIZE); -} - -inline v2s16 getNodeSectorPos(v2s16 p) +inline v3s16 getNodeBlockPos(const v3s16 &p) { return getContainerPos(p, MAP_BLOCKSIZE); } -inline s16 getNodeBlockY(s16 y) -{ - return getContainerPos(y, MAP_BLOCKSIZE); -} - inline void getNodeBlockPosWithOffset(const v3s16 &p, v3s16 &block, v3s16 &offset) { getContainerPosWithOffset(p, MAP_BLOCKSIZE, block, offset); } -inline void getNodeSectorPosWithOffset(const v2s16 &p, v2s16 &block, v2s16 &offset) -{ - getContainerPosWithOffset(p, MAP_BLOCKSIZE, block, offset); -} - /* Get a quick string to describe what a block actually contains */ |