Shorten ManualMapVoxelManipulator to MMVManip

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

View File

@ -28,7 +28,7 @@ class MapgenV7;
class CaveV6 {
public:
MapgenV6 *mg;
ManualMapVoxelManipulator *vm;
MMVManip *vm;
INodeDefManager *ndef;
s16 min_tunnel_diameter;
@ -44,22 +44,22 @@ public:
s16 max_stone_y;
v3s16 node_min;
v3s16 node_max;
v3f orp; // starting point, relative to caved space
v3s16 of; // absolute coordinates of caved space
v3s16 ar; // allowed route area
s16 rs; // tunnel radius size
v3f main_direction;
s16 route_y_min;
s16 route_y_max;
PseudoRandom *ps;
PseudoRandom *ps2;
content_t c_water_source;
content_t c_lava_source;
int water_level;
CaveV6() {}
@ -72,7 +72,7 @@ public:
class CaveV7 {
public:
MapgenV7 *mg;
ManualMapVoxelManipulator *vm;
MMVManip *vm;
INodeDefManager *ndef;
NoiseParams *np_caveliquids;
@ -90,22 +90,22 @@ public:
s16 max_stone_y;
v3s16 node_min;
v3s16 node_max;
v3f orp; // starting point, relative to caved space
v3s16 of; // absolute coordinates of caved space
v3s16 ar; // allowed route area
s16 rs; // tunnel radius size
v3f main_direction;
s16 route_y_min;
s16 route_y_max;
PseudoRandom *ps;
content_t c_water_source;
content_t c_lava_source;
content_t c_ice;
int water_level;
CaveV7() {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
if (c_decos.size() == 0)
@ -287,8 +287,7 @@ bool DecoSimple::canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p)
}
size_t DecoSimple::generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
s16 max_y, v3s16 p)
size_t DecoSimple::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p)
{
if (!canPlaceDecoration(vm, p))
return 0;
@ -325,8 +324,7 @@ int DecoSimple::getHeight()
///////////////////////////////////////////////////////////////////////////////
size_t DecoSchematic::generate(ManualMapVoxelManipulator *vm, PseudoRandom *pr,
s16 max_y, v3s16 p)
size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, s16 max_y, v3s16 p)
{
if (flags & DECO_PLACE_CENTER_X)
p.X -= (schematic->size.X + 1) / 2;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class Map;
class MapBlock;
class ManualMapVoxelManipulator;
class MMVManip;
/*
VoxelManip
@ -64,9 +64,9 @@ private:
static int l_get_emerged_area(lua_State *L);
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);
~LuaVoxelManip();

View File

@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
namespace treegen
{
void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
void make_tree(MMVManip &vmanip, v3s16 p0,
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();
std::map<v3s16, MapBlock*> modified_blocks;
ManualMapVoxelManipulator vmanip(map);
MMVManip vmanip(map);
v3s16 tree_blockp = getNodeBlockPos(p0);
treegen::error e;
@ -151,7 +151,7 @@ treegen::error spawn_ltree(ServerEnvironment *env, v3s16 p0, INodeDefManager *nd
}
//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)
{
MapNode dirtnode(ndef->getId("mapgen_dirt"));
@ -414,7 +414,7 @@ treegen::error make_ltree(ManualMapVoxelManipulator &vmanip, v3s16 p0, INodeDefM
return SUCCESS;
}
void tree_node_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
void tree_node_placement(MMVManip &vmanip, v3f p0,
MapNode node)
{
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;
}
void tree_trunk_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
void tree_trunk_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition)
{
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;
}
void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
void tree_leaves_placement(MMVManip &vmanip, v3f p0,
PseudoRandom ps ,TreeDef &tree_definition)
{
MapNode leavesnode=tree_definition.leavesnode;
@ -452,7 +452,7 @@ void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
u32 vi = vmanip.m_area.index(p1);
if(vmanip.m_data[vi].getContent() != CONTENT_AIR
&& vmanip.m_data[vi].getContent() != CONTENT_IGNORE)
return;
return;
if (tree_definition.fruit_chance>0)
{
if (ps.range(1,100) > 100-tree_definition.fruit_chance)
@ -464,7 +464,7 @@ void tree_leaves_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
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)
{
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;
}
void tree_fruit_placement(ManualMapVoxelManipulator &vmanip, v3f p0,
void tree_fruit_placement(MMVManip &vmanip, v3f p0,
TreeDef &tree_definition)
{
v3s16 p1 = v3s16(myround(p0.X),myround(p0.Y),myround(p0.Z));
@ -560,7 +560,7 @@ void make_jungletree(VoxelManipulator &vmanip, v3s16 p0,
v3s16 p2 = p0 + v3s16(x,-1,z);
u32 vi1 = vmanip.m_area.index(p1);
u32 vi2 = vmanip.m_area.index(p2);
if (vmanip.m_area.contains(p2) &&
vmanip.m_data[vi2].getContent() == CONTENT_AIR)
vmanip.m_data[vi2] = treenode;

View File

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