Decoration: Place decorations in mgv6, check if air or cignore before placement
authorkwolekr <kwolekr@minetest.net>
Tue, 18 Jun 2013 01:59:42 +0000 (21:59 -0400)
committerkwolekr <kwolekr@minetest.net>
Tue, 18 Jun 2013 01:59:57 +0000 (21:59 -0400)
src/mapgen.cpp
src/mapgen_v6.cpp

index d2bde00637b4de1b6715d2c9f14de396ec78eebb..72757f4fac6f13f24ddd2eb5698d2128c71eabdb 100644 (file)
@@ -421,17 +421,22 @@ void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, s16 start_y,
        }
        
        size_t ndecos = c_decolist.size();
-       content_t c = ndecos ? c_decolist[pr->range(0, ndecos - 1)] : c_deco;
+       content_t c_place = ndecos ? c_decolist[pr->range(0, ndecos - 1)] : c_deco;
 
        s16 height = (deco_height_max > 0) ?
                pr->range(deco_height, deco_height_max) : deco_height;
 
        height = MYMIN(height, max_y - p.Y);
-
+       
        v3s16 em = vm->m_area.getExtent();
        for (int i = start_y; i < height; i++) {
                vm->m_area.add_y(em, vi, 1);
-               vm->m_data[vi] = MapNode(c);
+               
+               content_t c = vm->m_data[vi].getContent();
+               if (c != CONTENT_AIR && c != CONTENT_IGNORE)
+                       break;
+               
+               vm->m_data[vi] = MapNode(c_place);
        }
 }
 
index a411f966b6038231986c098589d99a81700909c9..d3db00dc20b0d93807a2376704cc69e118edf1f6 100644 (file)
@@ -445,6 +445,12 @@ void MapgenV6::makeChunk(BlockMakeData *data) {
        // Generate some trees, and add grass, if a jungle
        if (flags & MG_TREES)
                placeTreesAndJungleGrass();
+       
+       // Generate the registered decorations
+       for (unsigned int i = 0; i != emerge->decorations.size(); i++) {
+               Decoration *deco = emerge->decorations[i];
+               deco->placeDeco(this, blockseed + i, node_min, node_max);
+       }
 
        // Generate the registered ores
        for (unsigned int i = 0; i != emerge->ores.size(); i++) {