Dungeongen: Also preserve river water nodes
authorparamat <mat.gregory@virginmedia.com>
Sat, 28 Nov 2015 14:51:22 +0000 (14:51 +0000)
committerparamat <mat.gregory@virginmedia.com>
Sun, 29 Nov 2015 21:55:43 +0000 (21:55 +0000)
For future river mapgens
Dungeons will not generate in river water, to
avoid dungeons filling and blocking river channels

src/dungeongen.cpp
src/dungeongen.h

index 9c6e24a603efe3f164ac944b8e2cc9bb244a42bb..bfaad9faa3a72f46b9228192a9f46a05fdde404c 100644 (file)
@@ -65,6 +65,9 @@ DungeonGen::DungeonGen(Mapgen *mapgen, DungeonParams *dparams)
                dp.np_wetness = nparams_dungeon_wetness;
                dp.np_density = nparams_dungeon_density;
        }
+
+       // For mapgens using river water
+       dp.c_river_water = mg->ndef->getId("mapgen_river_water_source");
 }
 
 
@@ -87,7 +90,7 @@ void DungeonGen::generate(u32 bseed, v3s16 nmin, v3s16 nmax)
                        u32 i = vm->m_area.index(nmin.X, y, z);
                        for (s16 x = nmin.X; x <= nmax.X; x++) {
                                content_t c = vm->m_data[i].getContent();
-                               if (c == CONTENT_AIR || c == dp.c_water)
+                               if (c == CONTENT_AIR || c == dp.c_water || c == dp.c_river_water)
                                        vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
                                i++;
                        }
index 4e1201d82df6df757269ec8c61ee145d6da1abd0..d209dd4bf153e53846aad9dbd33d5f9a3f1299e4 100644 (file)
@@ -40,6 +40,7 @@ int dir_to_facedir(v3s16 d);
 
 struct DungeonParams {
        content_t c_water;
+       content_t c_river_water;
        content_t c_cobble;
        content_t c_moss;
        content_t c_stair;