diff options
author | paramat <mat.gregory@virginmedia.com> | 2015-03-14 04:26:04 +0000 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2015-03-15 04:15:48 +0000 |
commit | 89217faec5723fa1dae3217994a553d395426a35 (patch) | |
tree | 040e7f3b63bd070b81bb649f90bf4f184c2c9d12 /src | |
parent | 155116852a6775521e20086be4e8a50b41fc07db (diff) | |
download | minetest-89217faec5723fa1dae3217994a553d395426a35.tar.gz minetest-89217faec5723fa1dae3217994a553d395426a35.tar.bz2 minetest-89217faec5723fa1dae3217994a553d395426a35.zip |
mg_decoration: Raise highest allowed deco top to max edge of voxelmanip
Remove max_y from functions, simplify code
Diffstat (limited to 'src')
-rw-r--r-- | src/mg_decoration.cpp | 12 | ||||
-rw-r--r-- | src/mg_decoration.h | 6 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp index ab9401e28..23bbfa730 100644 --- a/src/mg_decoration.cpp +++ b/src/mg_decoration.cpp @@ -147,9 +147,7 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) y < y_min || y > y_max) continue; - int height = getHeight(); - int max_y = nmax.Y;// + MAP_BLOCKSIZE - 1; - if (y + 1 + height > max_y) { + if (y + getHeight() >= mg->vm->m_area.MaxEdge.Y) { continue; #if 0 printf("Decoration at (%d %d %d) cut off\n", x, y, z); @@ -170,7 +168,7 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) } v3s16 pos(x, y, z); - if (generate(mg->vm, &ps, max_y, pos)) + if (generate(mg->vm, &ps, pos)) mg->gennotify.addEvent(GENNOTIFY_DECORATION, pos, id); } } @@ -289,7 +287,7 @@ bool DecoSimple::canPlaceDecoration(MMVManip *vm, v3s16 p) } -size_t DecoSimple::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p) +size_t DecoSimple::generate(MMVManip *vm, PseudoRandom *pr, v3s16 p) { if (!canPlaceDecoration(vm, p)) return 0; @@ -299,8 +297,6 @@ size_t DecoSimple::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p) s16 height = (deco_height_max > 0) ? pr->range(deco_height, deco_height_max) : deco_height; - height = MYMIN(height, max_y - p.Y); - v3s16 em = vm->m_area.getExtent(); u32 vi = vm->m_area.index(p); for (int i = 0; i < height; i++) { @@ -326,7 +322,7 @@ int DecoSimple::getHeight() /////////////////////////////////////////////////////////////////////////////// -size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p) +size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, v3s16 p) { if (flags & DECO_PLACE_CENTER_X) p.X -= (schematic->size.X + 1) / 2; diff --git a/src/mg_decoration.h b/src/mg_decoration.h index fd7739b92..20a22d449 100644 --- a/src/mg_decoration.h +++ b/src/mg_decoration.h @@ -84,7 +84,7 @@ public: size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); - virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p) = 0; + virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p) = 0; virtual int getHeight() = 0; }; @@ -99,7 +99,7 @@ public: virtual void resolveNodeNames(NodeResolveInfo *nri); bool canPlaceDecoration(MMVManip *vm, v3s16 p); - virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p); + virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p); virtual int getHeight(); }; @@ -109,7 +109,7 @@ public: Schematic *schematic; std::string filename; - virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p); + virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p); virtual int getHeight(); }; |