aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2013-03-29 11:15:49 -0400
committerkwolekr <kwolekr@minetest.net>2013-03-29 11:15:49 -0400
commitb0f39da131bc24a41c5d5c8a03d06192937a4568 (patch)
treeace190c66b421b6cb6cb074379fcc36b665c45af
parentd01b74d00a39e38a898265adc0dbd3f15493cdc7 (diff)
downloadminetest-b0f39da131bc24a41c5d5c8a03d06192937a4568.tar.gz
minetest-b0f39da131bc24a41c5d5c8a03d06192937a4568.tar.bz2
minetest-b0f39da131bc24a41c5d5c8a03d06192937a4568.zip
Don't replace existing nodes in singlenode mapgen
-rw-r--r--src/mapgen_singlenode.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mapgen_singlenode.cpp b/src/mapgen_singlenode.cpp
index 04bf02bd1..7fa56eaf1 100644
--- a/src/mapgen_singlenode.cpp
+++ b/src/mapgen_singlenode.cpp
@@ -72,13 +72,18 @@ void MapgenSinglenode::makeChunk(BlockMakeData *data) {
v3s16 node_max = (blockpos_max+v3s16(1,1,1))*MAP_BLOCKSIZE-v3s16(1,1,1);
content_t c_node = ndef->getId("mapgen_singlenode");
- if(c_node == CONTENT_IGNORE)
+ if (c_node == CONTENT_IGNORE)
c_node = CONTENT_AIR;
- for(s16 z=node_min.Z; z<=node_max.Z; z++)
- for(s16 y=node_min.Y; y<=node_max.Y; y++)
- for(s16 x=node_min.X; x<=node_max.X; x++)
- {
- data->vmanip->setNode(v3s16(x,y,z), MapNode(c_node));
+
+ MapNode n_node(c_node);
+ int i = 0;
+
+ for (s16 z=node_min.Z; z<=node_max.Z; z++)
+ for (s16 y=node_min.Y; y<=node_max.Y; y++)
+ for (s16 x=node_min.X; x<=node_max.X; x++) {
+ if (vm->m_data[i].getContent() == CONTENT_IGNORE)
+ vm->m_data[i] = n_node;
+ i++;
}
// Add top and bottom side of water to transforming_liquid queue