aboutsummaryrefslogtreecommitdiff
path: root/src/map.h
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2024-06-28 08:00:00 +0800
committerRunxi Yu <me@runxiyu.org>2024-06-28 08:00:00 +0800
commit11c7849bdf53557bc327fee06bddbbf1e23c4512 (patch)
treea90dba953d7cc9584c979ad3b6772f55c58f42ed /src/map.h
parent53dd648c96b899b706f30de656896713d7e8ff08 (diff)
downloadhax-minetest-server-11c7849bdf53557bc327fee06bddbbf1e23c4512.tar.gz
hax-minetest-server-11c7849bdf53557bc327fee06bddbbf1e23c4512.zip
Hax's version of Minetest Server 5.6.0
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/map.h b/src/map.h
index 6bc2aaaee..833d750eb 100644
--- a/src/map.h
+++ b/src/map.h
@@ -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;