diff options
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 */ |