1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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
This commit is contained in:
Loic Blot 2017-08-19 09:12:54 +02:00
parent e53d8a7536
commit b5f7249a7e
No known key found for this signature in database
GPG key ID: EFAA458E8C153987
13 changed files with 161 additions and 246 deletions

View file

@ -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)
inline v3s16 getNodeBlockPos(const v3s16 &p)
{
return getContainerPos(p, MAP_BLOCKSIZE);
}
inline v2s16 getNodeSectorPos(v2s16 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
*/