aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-01-27 01:40:57 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-27 18:52:36 +0300
commitbdcca4767c77ccd48b71fa6a5277d72171129da8 (patch)
treeac671116fe6e4a016cd8fc37b21e542e17752d43 /src/mapgen.cpp
parent38f4dbfb510a6e81f54b28c27c1c5b8e7d16d7a4 (diff)
downloadminetest-bdcca4767c77ccd48b71fa6a5277d72171129da8.tar.gz
minetest-bdcca4767c77ccd48b71fa6a5277d72171129da8.tar.bz2
minetest-bdcca4767c77ccd48b71fa6a5277d72171129da8.zip
Make mapgen generate stuff in chunks of 3^3 mapblocks
Diffstat (limited to 'src/mapgen.cpp')
-rw-r--r--src/mapgen.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index fe2ce13f5..0b8781f5a 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -1491,23 +1491,34 @@ void make_block(BlockMakeData *data)
assert(data->vmanip);
assert(data->nodedef);
+ assert(data->blockpos_requested.X >= data->blockpos_min.X &&
+ data->blockpos_requested.Y >= data->blockpos_min.Y &&
+ data->blockpos_requested.Z >= data->blockpos_min.Z);
+ assert(data->blockpos_requested.X <= data->blockpos_max.X &&
+ data->blockpos_requested.Y <= data->blockpos_max.Y &&
+ data->blockpos_requested.Z <= data->blockpos_max.Z);
INodeDefManager *ndef = data->nodedef;
- v3s16 blockpos = data->blockpos;
+ // Hack: use minimum block coordinates for old code that assumes
+ // a single block
+ v3s16 blockpos = data->blockpos_min;
/*dstream<<"makeBlock(): ("<<blockpos.X<<","<<blockpos.Y<<","
<<blockpos.Z<<")"<<std::endl;*/
+ v3s16 blockpos_min = data->blockpos_min;
+ v3s16 blockpos_max = data->blockpos_max;
+ v3s16 blockpos_full_min = blockpos_min - v3s16(1,1,1);
+ v3s16 blockpos_full_max = blockpos_max + v3s16(1,1,1);
+
ManualMapVoxelManipulator &vmanip = *(data->vmanip);
- v3s16 blockpos_min = blockpos - v3s16(1,1,1);
- v3s16 blockpos_max = blockpos + v3s16(1,1,1);
// Area of center block
- v3s16 node_min = blockpos*MAP_BLOCKSIZE;
- v3s16 node_max = (blockpos+v3s16(1,1,1))*MAP_BLOCKSIZE-v3s16(1,1,1);
+ v3s16 node_min = blockpos_min*MAP_BLOCKSIZE;
+ v3s16 node_max = (blockpos_max+v3s16(1,1,1))*MAP_BLOCKSIZE-v3s16(1,1,1);
// Full allocated area
- v3s16 full_node_min = (blockpos-1)*MAP_BLOCKSIZE;
- v3s16 full_node_max = (blockpos+2)*MAP_BLOCKSIZE-v3s16(1,1,1);
+ v3s16 full_node_min = (blockpos_min-1)*MAP_BLOCKSIZE;
+ v3s16 full_node_max = (blockpos_max+2)*MAP_BLOCKSIZE-v3s16(1,1,1);
// Area of a block
double block_area_nodes = MAP_BLOCKSIZE*MAP_BLOCKSIZE;