diff options
Diffstat (limited to '')
-rw-r--r-- | src/map.h | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes_bloated.h" #include "mapnode.h" +#include "mapblock.h" #include "constants.h" #include "voxel.h" #include "modifiedstate.h" @@ -49,6 +50,7 @@ class EmergeManager; class MetricsBackend; class ServerEnvironment; struct BlockMakeData; +class Server; /* MapEditEvent @@ -166,7 +168,23 @@ public: // Returns a CONTENT_IGNORE node if not found // If is_valid_position is not NULL then this will be set to true if the // position is valid, otherwise false - MapNode getNode(v3s16 p, bool *is_valid_position = NULL); + inline MapNode getNode(v3s16 p, bool *is_valid_position = NULL) + { + v3s16 blockpos = getNodeBlockPos(p); + MapBlock *block = getBlockNoCreateNoEx(blockpos); + if (block == NULL) { + if (is_valid_position != NULL) + *is_valid_position = false; + return {CONTENT_IGNORE}; + } + + v3s16 relpos = p - blockpos*MAP_BLOCKSIZE; + bool is_valid_p; + MapNode node = block->getNodeNoCheck(relpos, &is_valid_p); + if (is_valid_position != NULL) + *is_valid_position = is_valid_p; + return node; + } /* These handle lighting but not faces. @@ -261,7 +279,7 @@ public: */ bool isBlockOccluded(MapBlock *block, v3s16 cam_pos_nodes); -protected: +//protected: IGameDef *m_gamedef; std::set<MapEventReceiver*> m_event_receivers; |