summaryrefslogtreecommitdiff
path: root/src/voxel.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-02-01 03:06:02 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-02-01 03:06:02 +0200
commit6e196c2ce4285c0aea2a5c714e842d90c1b84b43 (patch)
treee1c25414910ed344ced69125ba4f8170dc27bc9f /src/voxel.h
parentbe851871cd43316d12fd9a5f2cc6dec98a1c9ce0 (diff)
downloadminetest-6e196c2ce4285c0aea2a5c714e842d90c1b84b43.tar.gz
minetest-6e196c2ce4285c0aea2a5c714e842d90c1b84b43.tar.bz2
minetest-6e196c2ce4285c0aea2a5c714e842d90c1b84b43.zip
partly working chunk-based map generator (doesn't save properly, spawn is pretty random)
Diffstat (limited to 'src/voxel.h')
-rw-r--r--src/voxel.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/voxel.h b/src/voxel.h
index ff5d534cb..89333159c 100644
--- a/src/voxel.h
+++ b/src/voxel.h
@@ -262,7 +262,31 @@ public:
{
return index(p.X, p.Y, p.Z);
}
+
+ // Translate index in the X coordinate
+ void add_x(const v3s16 &extent, u32 &i, s16 a)
+ {
+ i += a;
+ }
+ // Translate index in the Y coordinate
+ void add_y(const v3s16 &extent, u32 &i, s16 a)
+ {
+ i += a * extent.X;
+ }
+ // Translate index in the Z coordinate
+ void add_z(const v3s16 &extent, u32 &i, s16 a)
+ {
+ i += a * extent.X*extent.Y;
+ }
+ // Translate index in space
+ void add_p(const v3s16 &extent, u32 &i, v3s16 a)
+ {
+ i += a.Z*extent.X*extent.Y + a.Y*extent.X + a.X;
+ }
+ /*
+ Print method for debugging
+ */
void print(std::ostream &o) const
{
v3s16 e = getExtent();
@@ -394,6 +418,10 @@ public:
*/
void copyFrom(MapNode *src, VoxelArea src_area,
v3s16 from_pos, v3s16 to_pos, v3s16 size);
+
+ // Copy data
+ void copyTo(MapNode *dst, VoxelArea dst_area,
+ v3s16 dst_pos, v3s16 from_pos, v3s16 size);
/*
Algorithms