Shorten ManualMapVoxelManipulator to MMVManip

This commit is contained in:
kwolekr 2015-01-05 02:42:27 -05:00
parent 7289d61e99
commit 2d849b0a19
18 changed files with 103 additions and 110 deletions

@ -28,7 +28,7 @@ class MapgenV7;
class CaveV6 { class CaveV6 {
public: public:
MapgenV6 *mg; MapgenV6 *mg;
ManualMapVoxelManipulator *vm; MMVManip *vm;
INodeDefManager *ndef; INodeDefManager *ndef;
s16 min_tunnel_diameter; s16 min_tunnel_diameter;
@ -72,7 +72,7 @@ public:
class CaveV7 { class CaveV7 {
public: public:
MapgenV7 *mg; MapgenV7 *mg;
ManualMapVoxelManipulator *vm; MMVManip *vm;
INodeDefManager *ndef; INodeDefManager *ndef;
NoiseParams *np_caveliquids; NoiseParams *np_caveliquids;

@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define VMANIP_FLAG_DUNGEON_UNTOUCHABLE (\ #define VMANIP_FLAG_DUNGEON_UNTOUCHABLE (\
VMANIP_FLAG_DUNGEON_INSIDE|VMANIP_FLAG_DUNGEON_PRESERVE) VMANIP_FLAG_DUNGEON_INSIDE|VMANIP_FLAG_DUNGEON_PRESERVE)
class ManualMapVoxelManipulator; class MMVManip;
class INodeDefManager; class INodeDefManager;
v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs); v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs);
@ -57,7 +57,7 @@ struct DungeonParams {
class DungeonGen { class DungeonGen {
public: public:
ManualMapVoxelManipulator *vm; MMVManip *vm;
Mapgen *mg; Mapgen *mg;
u32 blockseed; u32 blockseed;
PseudoRandom random; PseudoRandom random;

@ -44,7 +44,7 @@ class DecorationManager;
class SchematicManager; class SchematicManager;
struct BlockMakeData { struct BlockMakeData {
ManualMapVoxelManipulator *vmanip; MMVManip *vmanip;
u64 seed; u64 seed;
v3s16 blockpos_min; v3s16 blockpos_min;
v3s16 blockpos_max; v3s16 blockpos_max;

@ -2305,7 +2305,7 @@ bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
v3s16 bigarea_blocks_min = blockpos_min - extra_borders; v3s16 bigarea_blocks_min = blockpos_min - extra_borders;
v3s16 bigarea_blocks_max = blockpos_max + extra_borders; v3s16 bigarea_blocks_max = blockpos_max + extra_borders;
data->vmanip = new ManualMapVoxelManipulator(this); data->vmanip = new MMVManip(this);
//data->vmanip->setMap(this); //data->vmanip->setMap(this);
// Add the area // Add the area
@ -2823,7 +2823,7 @@ void ServerMap::updateVManip(v3s16 pos)
if (!mg) if (!mg)
return; return;
ManualMapVoxelManipulator *vm = mg->vm; MMVManip *vm = mg->vm;
if (!vm) if (!vm)
return; return;
@ -3589,7 +3589,7 @@ void ServerMap::PrintInfo(std::ostream &out)
out<<"ServerMap: "; out<<"ServerMap: ";
} }
ManualMapVoxelManipulator::ManualMapVoxelManipulator(Map *map): MMVManip::MMVManip(Map *map):
VoxelManipulator(), VoxelManipulator(),
m_is_dirty(false), m_is_dirty(false),
m_create_area(false), m_create_area(false),
@ -3597,12 +3597,12 @@ ManualMapVoxelManipulator::ManualMapVoxelManipulator(Map *map):
{ {
} }
ManualMapVoxelManipulator::~ManualMapVoxelManipulator() MMVManip::~MMVManip()
{ {
} }
void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min, void MMVManip::initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max,
v3s16 blockpos_max, bool load_if_inexistent) bool load_if_inexistent)
{ {
TimeTaker timer1("initialEmerge", &emerge_time); TimeTaker timer1("initialEmerge", &emerge_time);
@ -3690,8 +3690,7 @@ void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min,
m_is_dirty = false; m_is_dirty = false;
} }
void ManualMapVoxelManipulator::blitBackAll( void MMVManip::blitBackAll(std::map<v3s16, MapBlock*> *modified_blocks,
std::map<v3s16, MapBlock*> *modified_blocks,
bool overwrite_generated) bool overwrite_generated)
{ {
if(m_area.getExtent() == v3s16(0,0,0)) if(m_area.getExtent() == v3s16(0,0,0))

@ -535,11 +535,11 @@ private:
#define VMANIP_BLOCK_DATA_INEXIST 1 #define VMANIP_BLOCK_DATA_INEXIST 1
#define VMANIP_BLOCK_CONTAINS_CIGNORE 2 #define VMANIP_BLOCK_CONTAINS_CIGNORE 2
class ManualMapVoxelManipulator : public VoxelManipulator class MMVManip : public VoxelManipulator
{ {
public: public:
ManualMapVoxelManipulator(Map *map); MMVManip(Map *map);
virtual ~ManualMapVoxelManipulator(); virtual ~MMVManip();
virtual void clear() virtual void clear()
{ {

@ -36,7 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MG_LIGHT 0x10 #define MG_LIGHT 0x10
class Settings; class Settings;
class ManualMapVoxelManipulator; class MMVManip;
class INodeDefManager; class INodeDefManager;
extern FlagDesc flagdesc_mapgen[]; extern FlagDesc flagdesc_mapgen[];
@ -45,7 +45,6 @@ extern FlagDesc flagdesc_gennotify[];
class Biome; class Biome;
class EmergeManager; class EmergeManager;
class MapBlock; class MapBlock;
class ManualMapVoxelManipulator;
class VoxelManipulator; class VoxelManipulator;
struct BlockMakeData; struct BlockMakeData;
class VoxelArea; class VoxelArea;
@ -134,7 +133,7 @@ public:
bool generating; bool generating;
int id; int id;
ManualMapVoxelManipulator *vm; MMVManip *vm;
INodeDefManager *ndef; INodeDefManager *ndef;
u32 blockseed; u32 blockseed;

@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mg_biome.h" #include "mg_biome.h"
#include "gamedef.h" #include "gamedef.h"
#include "nodedef.h" #include "nodedef.h"
#include "map.h" //for ManualMapVoxelManipulator #include "map.h" //for MMVManip
#include "log.h" #include "log.h"
#include "util/numeric.h" #include "util/numeric.h"
#include "main.h" #include "main.h"

@ -242,7 +242,7 @@ void DecoSimple::resolveNodeNames(NodeResolveInfo *nri)
} }
bool DecoSimple::canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p) bool DecoSimple::canPlaceDecoration(MMVManip *vm, v3s16 p)
{ {
// Don't bother if there aren't any decorations to place // Don't bother if there aren't any decorations to place
if (c_decos.size() == 0) if (c_decos.size() == 0)
@ -287,8 +287,7 @@ bool DecoSimple::canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p)
} }
size_t DecoSimple::generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr, size_t DecoSimple::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p)
s16 max_y, v3s16 p)
{ {
if (!canPlaceDecoration(vm, p)) if (!canPlaceDecoration(vm, p))
return 0; return 0;
@ -325,8 +324,7 @@ int DecoSimple::getHeight()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
size_t DecoSchematic::generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr, size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p)
s16 max_y, v3s16 p)
{ {
if (flags & DECO_PLACE_CENTER_X) if (flags & DECO_PLACE_CENTER_X)
p.X -= (schematic->size.X + 1) / 2; p.X -= (schematic->size.X + 1) / 2;

@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
struct NoiseParams; struct NoiseParams;
class Mapgen; class Mapgen;
class ManualMapVoxelManipulator; class MMVManip;
class PseudoRandom; class PseudoRandom;
class Schematic; class Schematic;
@ -83,8 +83,7 @@ public:
size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
//size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr, virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p) = 0;
s16 max_y, v3s16 p) = 0;
virtual int getHeight() = 0; virtual int getHeight() = 0;
}; };
@ -98,9 +97,8 @@ public:
virtual void resolveNodeNames(NodeResolveInfo *nri); virtual void resolveNodeNames(NodeResolveInfo *nri);
bool canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p); bool canPlaceDecoration(MMVManip *vm, v3s16 p);
virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr, virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p);
s16 max_y, v3s16 p);
virtual int getHeight(); virtual int getHeight();
}; };
@ -110,8 +108,7 @@ public:
Schematic *schematic; Schematic *schematic;
std::string filename; std::string filename;
virtual size_t generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr, virtual size_t generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p);
s16 max_y, v3s16 p);
virtual int getHeight(); virtual int getHeight();
}; };

@ -123,8 +123,8 @@ size_t Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void OreScatter::generate(ManualMapVoxelManipulator *vm, int mapseed, void OreScatter::generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax) v3s16 nmin, v3s16 nmax)
{ {
PseudoRandom pr(blockseed); PseudoRandom pr(blockseed);
MapNode n_ore(c_ore, 0, ore_param2); MapNode n_ore(c_ore, 0, ore_param2);
@ -164,8 +164,8 @@ void OreScatter::generate(ManualMapVoxelManipulator *vm, int mapseed,
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void OreSheet::generate(ManualMapVoxelManipulator *vm, int mapseed, void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax) v3s16 nmin, v3s16 nmax)
{ {
PseudoRandom pr(blockseed + 4234); PseudoRandom pr(blockseed + 4234);
MapNode n_ore(c_ore, 0, ore_param2); MapNode n_ore(c_ore, 0, ore_param2);
@ -206,8 +206,8 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int mapseed,
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void OreBlob::generate(ManualMapVoxelManipulator *vm, int mapseed, void OreBlob::generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax) v3s16 nmin, v3s16 nmax)
{ {
PseudoRandom pr(blockseed + 2404); PseudoRandom pr(blockseed + 2404);
MapNode n_ore(c_ore, 0, ore_param2); MapNode n_ore(c_ore, 0, ore_param2);
@ -269,8 +269,8 @@ OreVein::~OreVein()
} }
void OreVein::generate(ManualMapVoxelManipulator *vm, int mapseed, void OreVein::generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax) v3s16 nmin, v3s16 nmax)
{ {
PseudoRandom pr(blockseed + 520); PseudoRandom pr(blockseed + 520);
MapNode n_ore(c_ore, 0, ore_param2); MapNode n_ore(c_ore, 0, ore_param2);

@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
struct NoiseParams; struct NoiseParams;
class Noise; class Noise;
class Mapgen; class Mapgen;
class ManualMapVoxelManipulator; class MMVManip;
/////////////////// Ore generation flags /////////////////// Ore generation flags
@ -70,32 +70,32 @@ public:
virtual void resolveNodeNames(NodeResolveInfo *nri); virtual void resolveNodeNames(NodeResolveInfo *nri);
size_t placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax); size_t placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
virtual void generate(ManualMapVoxelManipulator *vm, int mapseed, virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax) = 0; v3s16 nmin, v3s16 nmax) = 0;
}; };
class OreScatter : public Ore { class OreScatter : public Ore {
public: public:
static const bool NEEDS_NOISE = false; static const bool NEEDS_NOISE = false;
virtual void generate(ManualMapVoxelManipulator *vm, int mapseed, virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax); v3s16 nmin, v3s16 nmax);
}; };
class OreSheet : public Ore { class OreSheet : public Ore {
public: public:
static const bool NEEDS_NOISE = true; static const bool NEEDS_NOISE = true;
virtual void generate(ManualMapVoxelManipulator *vm, int mapseed, virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax); v3s16 nmin, v3s16 nmax);
}; };
class OreBlob : public Ore { class OreBlob : public Ore {
public: public:
static const bool NEEDS_NOISE = true; static const bool NEEDS_NOISE = true;
virtual void generate(ManualMapVoxelManipulator *vm, int mapseed, virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax); v3s16 nmin, v3s16 nmax);
}; };
class OreVein : public Ore { class OreVein : public Ore {
@ -107,8 +107,8 @@ public:
virtual ~OreVein(); virtual ~OreVein();
virtual void generate(ManualMapVoxelManipulator *vm, int mapseed, virtual void generate(MMVManip *vm, int mapseed, u32 blockseed,
u32 blockseed, v3s16 nmin, v3s16 nmax); v3s16 nmin, v3s16 nmax);
}; };
class OreManager : public GenElementManager { class OreManager : public GenElementManager {

@ -77,8 +77,8 @@ void Schematic::updateContentIds()
} }
void Schematic::blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm, void Schematic::blitToVManip(v3s16 p, MMVManip *vm, Rotation rot,
Rotation rot, bool force_placement, INodeDefManager *ndef) bool force_placement, INodeDefManager *ndef)
{ {
int xstride = 1; int xstride = 1;
int ystride = size.X; int ystride = size.X;
@ -156,11 +156,11 @@ void Schematic::blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm,
} }
void Schematic::placeStructure(Map *map, v3s16 p, u32 flags, void Schematic::placeStructure(Map *map, v3s16 p, u32 flags, Rotation rot,
Rotation rot, bool force_placement, INodeDefManager *ndef) bool force_placement, INodeDefManager *ndef)
{ {
assert(schemdata != NULL); assert(schemdata != NULL);
ManualMapVoxelManipulator *vm = new ManualMapVoxelManipulator(map); MMVManip *vm = new MMVManip(map);
if (rot == ROTATE_RAND) if (rot == ROTATE_RAND)
rot = (Rotation)myrand_range(ROTATE_0, ROTATE_270); rot = (Rotation)myrand_range(ROTATE_0, ROTATE_270);
@ -200,8 +200,8 @@ void Schematic::placeStructure(Map *map, v3s16 p, u32 flags,
} }
bool Schematic::loadSchematicFromFile(const char *filename, bool Schematic::loadSchematicFromFile(const char *filename, INodeDefManager *ndef,
INodeDefManager *ndef, std::map<std::string, std::string> &replace_names) std::map<std::string, std::string> &replace_names)
{ {
content_t cignore = CONTENT_IGNORE; content_t cignore = CONTENT_IGNORE;
bool have_cignore = false; bool have_cignore = false;
@ -357,7 +357,7 @@ void build_nnlist_and_update_ids(MapNode *nodes, u32 nodecount,
bool Schematic::getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2) bool Schematic::getSchematicFromMap(Map *map, v3s16 p1, v3s16 p2)
{ {
ManualMapVoxelManipulator *vm = new ManualMapVoxelManipulator(map); MMVManip *vm = new MMVManip(map);
v3s16 bp1 = getNodeBlockPos(p1); v3s16 bp1 = getNodeBlockPos(p1);
v3s16 bp2 = getNodeBlockPos(p2); v3s16 bp2 = getNodeBlockPos(p2);

@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class Map; class Map;
class Mapgen; class Mapgen;
class ManualMapVoxelManipulator; class MMVManip;
class PseudoRandom; class PseudoRandom;
class NodeResolver; class NodeResolver;
@ -58,7 +58,7 @@ public:
void updateContentIds(); void updateContentIds();
void blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm, void blitToVManip(v3s16 p, MMVManip *vm,
Rotation rot, bool force_placement, INodeDefManager *ndef); Rotation rot, bool force_placement, INodeDefManager *ndef);
bool loadSchematicFromFile(const char *filename, INodeDefManager *ndef, bool loadSchematicFromFile(const char *filename, INodeDefManager *ndef,

@ -240,7 +240,7 @@ int ModApiMapgen::l_get_mapgen_object(lua_State *L)
switch (mgobj) { switch (mgobj) {
case MGOBJ_VMANIP: { case MGOBJ_VMANIP: {
ManualMapVoxelManipulator *vm = mg->vm; MMVManip *vm = mg->vm;
// VoxelManip object // VoxelManip object
LuaVoxelManip *o = new LuaVoxelManip(vm, true); LuaVoxelManip *o = new LuaVoxelManip(vm, true);

@ -44,7 +44,7 @@ int LuaVoxelManip::gc_object(lua_State *L)
int LuaVoxelManip::l_read_from_map(lua_State *L) int LuaVoxelManip::l_read_from_map(lua_State *L)
{ {
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
v3s16 bp1 = getNodeBlockPos(read_v3s16(L, 2)); v3s16 bp1 = getNodeBlockPos(read_v3s16(L, 2));
v3s16 bp2 = getNodeBlockPos(read_v3s16(L, 3)); v3s16 bp2 = getNodeBlockPos(read_v3s16(L, 3));
@ -63,7 +63,7 @@ int LuaVoxelManip::l_get_data(lua_State *L)
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
int volume = vm->m_area.getVolume(); int volume = vm->m_area.getVolume();
@ -82,7 +82,7 @@ int LuaVoxelManip::l_set_data(lua_State *L)
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
if (!lua_istable(L, 2)) if (!lua_istable(L, 2))
return 0; return 0;
@ -103,7 +103,7 @@ int LuaVoxelManip::l_set_data(lua_State *L)
int LuaVoxelManip::l_write_to_map(lua_State *L) int LuaVoxelManip::l_write_to_map(lua_State *L)
{ {
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
vm->blitBackAll(&o->modified_blocks); vm->blitBackAll(&o->modified_blocks);
@ -144,7 +144,7 @@ int LuaVoxelManip::l_update_liquids(lua_State *L)
Map *map = &(env->getMap()); Map *map = &(env->getMap());
INodeDefManager *ndef = getServer(L)->getNodeDefManager(); INodeDefManager *ndef = getServer(L)->getNodeDefManager();
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
Mapgen mg; Mapgen mg;
mg.vm = vm; mg.vm = vm;
@ -166,7 +166,7 @@ int LuaVoxelManip::l_calc_lighting(lua_State *L)
INodeDefManager *ndef = getServer(L)->getNodeDefManager(); INodeDefManager *ndef = getServer(L)->getNodeDefManager();
EmergeManager *emerge = getServer(L)->getEmergeManager(); EmergeManager *emerge = getServer(L)->getEmergeManager();
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
v3s16 yblock = v3s16(0, 1, 0) * MAP_BLOCKSIZE; v3s16 yblock = v3s16(0, 1, 0) * MAP_BLOCKSIZE;
v3s16 fpmin = vm->m_area.MinEdge; v3s16 fpmin = vm->m_area.MinEdge;
@ -203,7 +203,7 @@ int LuaVoxelManip::l_set_lighting(lua_State *L)
light = (getintfield_default(L, 2, "day", 0) & 0x0F); light = (getintfield_default(L, 2, "day", 0) & 0x0F);
light |= (getintfield_default(L, 2, "night", 0) & 0x0F) << 4; light |= (getintfield_default(L, 2, "night", 0) & 0x0F) << 4;
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
v3s16 yblock = v3s16(0, 1, 0) * MAP_BLOCKSIZE; v3s16 yblock = v3s16(0, 1, 0) * MAP_BLOCKSIZE;
v3s16 pmin = lua_istable(L, 3) ? read_v3s16(L, 3) : vm->m_area.MinEdge + yblock; v3s16 pmin = lua_istable(L, 3) ? read_v3s16(L, 3) : vm->m_area.MinEdge + yblock;
@ -226,7 +226,7 @@ int LuaVoxelManip::l_get_light_data(lua_State *L)
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
int volume = vm->m_area.getVolume(); int volume = vm->m_area.getVolume();
@ -245,7 +245,7 @@ int LuaVoxelManip::l_set_light_data(lua_State *L)
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
if (!lua_istable(L, 2)) if (!lua_istable(L, 2))
return 0; return 0;
@ -268,7 +268,7 @@ int LuaVoxelManip::l_get_param2_data(lua_State *L)
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
int volume = vm->m_area.getVolume(); int volume = vm->m_area.getVolume();
@ -287,7 +287,7 @@ int LuaVoxelManip::l_set_param2_data(lua_State *L)
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
if (!lua_istable(L, 2)) if (!lua_istable(L, 2))
return 0; return 0;
@ -344,7 +344,7 @@ int LuaVoxelManip::l_was_modified(lua_State *L)
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1); LuaVoxelManip *o = checkobject(L, 1);
ManualMapVoxelManipulator *vm = o->vm; MMVManip *vm = o->vm;
lua_pushboolean(L, vm->m_is_dirty); lua_pushboolean(L, vm->m_is_dirty);
@ -361,7 +361,7 @@ int LuaVoxelManip::l_get_emerged_area(lua_State *L)
return 2; return 2;
} }
LuaVoxelManip::LuaVoxelManip(ManualMapVoxelManipulator *mmvm, bool is_mg_vm) LuaVoxelManip::LuaVoxelManip(MMVManip *mmvm, bool is_mg_vm)
{ {
this->vm = mmvm; this->vm = mmvm;
this->is_mapgen_vm = is_mg_vm; this->is_mapgen_vm = is_mg_vm;
@ -369,13 +369,13 @@ LuaVoxelManip::LuaVoxelManip(ManualMapVoxelManipulator *mmvm, bool is_mg_vm)
LuaVoxelManip::LuaVoxelManip(Map *map) LuaVoxelManip::LuaVoxelManip(Map *map)
{ {
this->vm = new ManualMapVoxelManipulator(map); this->vm = new MMVManip(map);
this->is_mapgen_vm = false; this->is_mapgen_vm = false;
} }
LuaVoxelManip::LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2) LuaVoxelManip::LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2)
{ {
this->vm = new ManualMapVoxelManipulator(map); this->vm = new MMVManip(map);
this->is_mapgen_vm = false; this->is_mapgen_vm = false;
v3s16 bp1 = getNodeBlockPos(p1); v3s16 bp1 = getNodeBlockPos(p1);

@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class Map; class Map;
class MapBlock; class MapBlock;
class ManualMapVoxelManipulator; class MMVManip;
/* /*
VoxelManip VoxelManip
@ -64,9 +64,9 @@ private:
static int l_get_emerged_area(lua_State *L); static int l_get_emerged_area(lua_State *L);
public: public:
ManualMapVoxelManipulator *vm; MMVManip *vm;
LuaVoxelManip(ManualMapVoxelManipulator *mmvm, bool is_mapgen_vm); LuaVoxelManip(MMVManip *mmvm, bool is_mapgen_vm);
LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2); LuaVoxelManip(Map *map, v3s16 p1, v3s16 p2);
LuaVoxelManip(Map *map); LuaVoxelManip(Map *map);
~LuaVoxelManip(); ~LuaVoxelManip();

@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
namespace treegen namespace treegen
{ {
void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0, void make_tree(MMVManip &vmanip, v3s16 p0,
bool is_apple_tree, INodeDefManager *ndef, int seed) bool is_apple_tree, INodeDefManager *ndef, int seed)
{ {
/* /*
@ -122,7 +122,7 @@ treegen::error spawn_ltree(ServerEnvironment *env, v3s16 p0, INodeDefManager *nd
{ {
ServerMap *map = &env->getServerMap(); ServerMap *map = &env->getServerMap();
std::map<v3s16, MapBlock*> modified_blocks; std::map<v3s16, MapBlock*> modified_blocks;
ManualMapVoxelManipulator vmanip(map); MMVManip vmanip(map);
v3s16 tree_blockp = getNodeBlockPos(p0); v3s16 tree_blockp = getNodeBlockPos(p0);
treegen::error e; treegen::error e;
@ -151,7 +151,7 @@ treegen::error spawn_ltree(ServerEnvironment *env, v3s16 p0, INodeDefManager *nd
} }
//L-System tree generator //L-System tree generator
treegen::error make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *ndef, treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef,
TreeDef tree_definition) TreeDef tree_definition)
{ {
MapNode dirtnode(ndef->getId("mapgen_dirt")); MapNode dirtnode(ndef->getId("mapgen_dirt"));
@ -414,7 +414,7 @@ treegen::error make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefM
return SUCCESS; return SUCCESS;
} }
void tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_node_placement(MMVManip &vmanip, v3f p0,
MapNode node) MapNode node)
{ {
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z)); v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
@ -427,7 +427,7 @@ void tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
vmanip.m_data[vmanip.m_area.index(p1)] = node; vmanip.m_data[vmanip.m_area.index(p1)] = node;
} }
void tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_trunk_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition) TreeDef &tree_definition)
{ {
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z)); v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
@ -440,7 +440,7 @@ void tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
vmanip.m_data[vmanip.m_area.index(p1)] = tree_definition.trunknode; vmanip.m_data[vmanip.m_area.index(p1)] = tree_definition.trunknode;
} }
void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps ,TreeDef &tree_definition) PseudoRandom ps ,TreeDef &tree_definition)
{ {
MapNode leavesnode=tree_definition.leavesnode; MapNode leavesnode=tree_definition.leavesnode;
@ -464,7 +464,7 @@ void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode; vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode;
} }
void tree_single_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_single_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps, TreeDef &tree_definition) PseudoRandom ps, TreeDef &tree_definition)
{ {
MapNode leavesnode=tree_definition.leavesnode; MapNode leavesnode=tree_definition.leavesnode;
@ -480,7 +480,7 @@ void tree_single_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode; vmanip.m_data[vmanip.m_area.index(p1)] = leavesnode;
} }
void tree_fruit_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_fruit_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition) TreeDef &tree_definition)
{ {
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z)); v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));

@ -23,7 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <matrix4.h> #include <matrix4.h>
#include "noise.h" #include "noise.h"
class ManualMapVoxelManipulator; class MMVManip;
class INodeDefManager; class INodeDefManager;
class ServerEnvironment; class ServerEnvironment;
@ -59,29 +59,29 @@ namespace treegen {
}; };
// Add default tree // Add default tree
void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0, void make_tree(MMVManip &vmanip, v3s16 p0,
bool is_apple_tree, INodeDefManager *ndef, int seed); bool is_apple_tree, INodeDefManager *ndef, int seed);
// Add jungle tree // Add jungle tree
void make_jungletree(VoxelManipulator &vmanip, v3s16 p0, void make_jungletree(VoxelManipulator &vmanip, v3s16 p0,
INodeDefManager *ndef, int seed); INodeDefManager *ndef, int seed);
// Add L-Systems tree (used by engine) // Add L-Systems tree (used by engine)
treegen::error make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefManager *ndef, treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef,
TreeDef tree_definition); TreeDef tree_definition);
// Spawn L-systems tree from LUA // Spawn L-systems tree from LUA
treegen::error spawn_ltree (ServerEnvironment *env, v3s16 p0, INodeDefManager *ndef, treegen::error spawn_ltree (ServerEnvironment *env, v3s16 p0, INodeDefManager *ndef,
TreeDef tree_definition); TreeDef tree_definition);
// L-System tree gen helper functions // L-System tree gen helper functions
void tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_node_placement(MMVManip &vmanip, v3f p0,
MapNode node); MapNode node);
void tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_trunk_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition); TreeDef &tree_definition);
void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps, TreeDef &tree_definition); PseudoRandom ps, TreeDef &tree_definition);
void tree_single_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_single_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps, TreeDef &tree_definition); PseudoRandom ps, TreeDef &tree_definition);
void tree_fruit_placement(ManualMapVoxelManipulator &vmanip, v3f p0, void tree_fruit_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition); TreeDef &tree_definition);
irr::core::matrix4 setRotationAxisRadians(irr::core::matrix4 M, double angle, v3f axis); irr::core::matrix4 setRotationAxisRadians(irr::core::matrix4 M, double angle, v3f axis);