diff options
author | paramat <paramat@users.noreply.github.com> | 2018-02-23 13:42:48 +0000 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2018-02-27 19:39:05 +0000 |
commit | c610643c4ca1d1c32ca3e400b5cb055f25401107 (patch) | |
tree | 73e1efd9fa3ba3c8269262d221a760e25a2b91e1 /src/mapgen/mg_schematic.cpp | |
parent | 6c9df2ffa7ee81a05b28fdd6123a926abd284c72 (diff) | |
download | minetest-c610643c4ca1d1c32ca3e400b5cb055f25401107.tar.gz minetest-c610643c4ca1d1c32ca3e400b5cb055f25401107.tar.bz2 minetest-c610643c4ca1d1c32ca3e400b5cb055f25401107.zip |
Place schematic (on vmanip): Enable use of 'place center' flags
For 'place schematic' and 'place schematic on vmanip' APIs.
Fix 'place center' code to properly centre schematics.
Fix some comments.
Diffstat (limited to 'src/mapgen/mg_schematic.cpp')
-rw-r--r-- | src/mapgen/mg_schematic.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mapgen/mg_schematic.cpp b/src/mapgen/mg_schematic.cpp index fc77194ac..ba619b2e0 100644 --- a/src/mapgen/mg_schematic.cpp +++ b/src/mapgen/mg_schematic.cpp @@ -188,15 +188,15 @@ bool Schematic::placeOnVManip(MMVManip *vm, v3s16 p, u32 flags, //// Adjust placement position if necessary if (flags & DECO_PLACE_CENTER_X) - p.X -= (s.X + 1) / 2; + p.X -= (s.X - 1) / 2; if (flags & DECO_PLACE_CENTER_Y) - p.Y -= (s.Y + 1) / 2; + p.Y -= (s.Y - 1) / 2; if (flags & DECO_PLACE_CENTER_Z) - p.Z -= (s.Z + 1) / 2; + p.Z -= (s.Z - 1) / 2; blitToVManip(vm, p, rot, force_place); - return vm->m_area.contains(VoxelArea(p, p + s - v3s16(1,1,1))); + return vm->m_area.contains(VoxelArea(p, p + s - v3s16(1, 1, 1))); } void Schematic::placeOnMap(ServerMap *map, v3s16 p, u32 flags, @@ -219,16 +219,16 @@ void Schematic::placeOnMap(ServerMap *map, v3s16 p, u32 flags, //// Adjust placement position if necessary if (flags & DECO_PLACE_CENTER_X) - p.X -= (s.X + 1) / 2; + p.X -= (s.X - 1) / 2; if (flags & DECO_PLACE_CENTER_Y) - p.Y -= (s.Y + 1) / 2; + p.Y -= (s.Y - 1) / 2; if (flags & DECO_PLACE_CENTER_Z) - p.Z -= (s.Z + 1) / 2; + p.Z -= (s.Z - 1) / 2; //// Create VManip for effected area, emerge our area, modify area //// inside VManip, then blit back. v3s16 bp1 = getNodeBlockPos(p); - v3s16 bp2 = getNodeBlockPos(p + s - v3s16(1,1,1)); + v3s16 bp2 = getNodeBlockPos(p + s - v3s16(1, 1, 1)); MMVManip vm(map); vm.initialEmerge(bp1, bp2); |