diff options
author | Perttu Ahola <celeron55@gmail.com> | 2010-11-29 10:52:07 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2010-11-29 10:52:07 +0200 |
commit | c707e00195f1035ae535f3fc8697af42e73190c0 (patch) | |
tree | 0e3c2553bb4726821e49dad599f64ecb5b3cec96 /src/mapblock.h | |
parent | e8fd5eb8eebbf12b0561d385ef8bc245d87e9ea6 (diff) | |
download | minetest-c707e00195f1035ae535f3fc8697af42e73190c0.tar.gz minetest-c707e00195f1035ae535f3fc8697af42e73190c0.tar.bz2 minetest-c707e00195f1035ae535f3fc8697af42e73190c0.zip |
sitä sun tätä tekeillä, toimii kivasti
Diffstat (limited to 'src/mapblock.h')
-rw-r--r-- | src/mapblock.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/mapblock.h b/src/mapblock.h index 60f78b6ff..48f877551 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -38,7 +38,9 @@ enum { NODECONTAINER_ID_MAPBLOCK, NODECONTAINER_ID_MAPSECTOR, - NODECONTAINER_ID_MAP + NODECONTAINER_ID_MAP, + NODECONTAINER_ID_MAPBLOCKCACHE, + NODECONTAINER_ID_VOXELMANIPULATOR, }; class NodeContainer @@ -246,6 +248,35 @@ public: } /* + Non-checking variants of the above + */ + + MapNode getNodeNoCheck(s16 x, s16 y, s16 z) + { + if(data == NULL) + throw InvalidPositionException(); + return data[z*MAP_BLOCKSIZE*MAP_BLOCKSIZE + y*MAP_BLOCKSIZE + x]; + } + + MapNode getNodeNoCheck(v3s16 p) + { + return getNodeNoCheck(p.X, p.Y, p.Z); + } + + void setNodeNoCheck(s16 x, s16 y, s16 z, MapNode & n) + { + if(data == NULL) + throw InvalidPositionException(); + data[z*MAP_BLOCKSIZE*MAP_BLOCKSIZE + y*MAP_BLOCKSIZE + x] = n; + setChangedFlag(); + } + + void setNodeNoCheck(v3s16 p, MapNode & n) + { + setNodeNoCheck(p.X, p.Y, p.Z, n); + } + + /* These functions consult the parent container if the position is not valid on this MapBlock. */ |