Skip to content

Commit 212945c

Browse files
committedJun 16, 2017
Mgv6 mudflow: Also check for 'ignore' nodes
Previously, when removing decorations we searched upwards and removed until we found air or water. However, the node above the decoration can be 'ignore' if a stacked decoration extends into the volume above the mapchunk. The result could be a problematic column of air placed in the volume of 'ignore'. The unnecessary placing of air also slows the function. Add a check for 'ignore' nodes when removing decorations.
1 parent 2ab09bb commit 212945c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed
 

Diff for: ‎src/mapgen_v6.cpp

+11-7
Original file line numberDiff line numberDiff line change
@@ -913,21 +913,25 @@ void MapgenV6::moveMud(u32 remove_index, u32 place_index,
913913
// use 'pos.X >= node_max.X' etc.
914914
if (pos.X >= node_max.X || pos.X <= node_min.X ||
915915
pos.Y >= node_max.Z || pos.Y <= node_min.Z) {
916-
// 'above remove' node is above removed mud. If it is not air and not
917-
// water it is a decoration that needs removing. Also search upwards
918-
// for a possible stacked decoration.
916+
// 'above remove' node is above removed mud. If it is not air, water or
917+
// 'ignore' it is a decoration that needs removing. Also search upwards
918+
// to remove a possible stacked decoration.
919+
// Check for 'ignore' because stacked decorations can penetrate into
920+
// 'ignore' nodes above the mapchunk.
919921
while (vm->m_area.contains(above_remove_index) &&
920922
vm->m_data[above_remove_index].getContent() != CONTENT_AIR &&
921-
vm->m_data[above_remove_index].getContent() != c_water_source) {
923+
vm->m_data[above_remove_index].getContent() != c_water_source &&
924+
vm->m_data[above_remove_index].getContent() != CONTENT_IGNORE) {
922925
vm->m_data[above_remove_index] = n_air;
923926
vm->m_area.add_y(em, above_remove_index, 1);
924927
}
925-
// Mud placed may have half-buried a tall decoration, search above and
926-
// remove.
928+
// Mud placed may have partially-buried a stacked decoration, search
929+
// above and remove.
927930
vm->m_area.add_y(em, place_index, 1);
928931
while (vm->m_area.contains(place_index) &&
929932
vm->m_data[place_index].getContent() != CONTENT_AIR &&
930-
vm->m_data[place_index].getContent() != c_water_source) {
933+
vm->m_data[place_index].getContent() != c_water_source &&
934+
vm->m_data[place_index].getContent() != CONTENT_IGNORE) {
931935
vm->m_data[place_index] = n_air;
932936
vm->m_area.add_y(em, place_index, 1);
933937
}

0 commit comments

Comments
 (0)