Skip to content

Commit ac6efa2

Browse files
committedApr 23, 2015
DecoSchematic: Fix missing trees in rough terrain
Move place_on check to before place_center_x/y/z displacement of p Reduce displacement of p by place_center_x/y/z flags to correctly position schematics
1 parent ccc09ab commit ac6efa2

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed
 

Diff for: ‎src/mg_decoration.cpp

+9-12
Original file line numberDiff line numberDiff line change
@@ -324,26 +324,23 @@ size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, v3s16 p)
324324
if (schematic == NULL)
325325
return 0;
326326

327-
if (flags & DECO_PLACE_CENTER_X)
328-
p.X -= (schematic->size.X + 1) / 2;
329-
if (flags & DECO_PLACE_CENTER_Y)
330-
p.Y -= (schematic->size.Y + 1) / 2;
331-
if (flags & DECO_PLACE_CENTER_Z)
332-
p.Z -= (schematic->size.Z + 1) / 2;
333-
334-
bool force_placement = (flags & DECO_FORCE_PLACEMENT);
335-
336-
if (!vm->m_area.contains(p))
337-
return 0;
338-
339327
u32 vi = vm->m_area.index(p);
340328
content_t c = vm->m_data[vi].getContent();
341329
if (!CONTAINS(c_place_on, c))
342330
return 0;
343331

332+
if (flags & DECO_PLACE_CENTER_X)
333+
p.X -= (schematic->size.X - 1) / 2;
334+
if (flags & DECO_PLACE_CENTER_Y)
335+
p.Y -= (schematic->size.Y - 1) / 2;
336+
if (flags & DECO_PLACE_CENTER_Z)
337+
p.Z -= (schematic->size.Z - 1) / 2;
338+
344339
Rotation rot = (rotation == ROTATE_RAND) ?
345340
(Rotation)pr->range(ROTATE_0, ROTATE_270) : rotation;
346341

342+
bool force_placement = (flags & DECO_FORCE_PLACEMENT);
343+
347344
schematic->blitToVManip(p, vm, rot, force_placement, m_ndef);
348345

349346
return 1;

0 commit comments

Comments
 (0)
Please sign in to comment.