if (partcount != 0)
p.Y += make_stairs;
- if (vm->m_area.contains(p) && vm->m_area.contains(p + v3s16(0, 1, 0)) &&
- vm->m_area.contains(v3s16(p.X - dir.X, p.Y - 1, p.Z - dir.Z))) {
+ // Check segment of minimum size corridor is in voxelmanip
+ if (vm->m_area.contains(p) && vm->m_area.contains(p + v3s16(0, 1, 0))) {
if (make_stairs) {
makeFill(p + v3s16(-1, -1, -1),
dp.holesize + v3s16(2, 3, 2),
for (u16 st = 0; st < stair_width; st++) {
u32 vi = vm->m_area.index(ps.X - dir.X, ps.Y - 1, ps.Z - dir.Z);
- if (vm->m_data[vi].getContent() == dp.c_wall)
+ if (vm->m_area.contains(ps + v3s16(-dir.X, -1, -dir.Z)) &&
+ vm->m_data[vi].getContent() == dp.c_wall)
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
vi = vm->m_area.index(ps.X, ps.Y, ps.Z);
- if (vm->m_data[vi].getContent() == dp.c_wall)
+ if (vm->m_area.contains(ps) &&
+ vm->m_data[vi].getContent() == dp.c_wall)
vm->m_data[vi] = MapNode(dp.c_stair, 0, facedir);
ps += swv;