mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 22:52:25 +01:00
Fix some lingering code style issues
This commit is contained in:
parent
0974337804
commit
f12118c38b
@ -140,7 +140,7 @@ EmergeManager::EmergeManager(IGameDef *gamedef)
|
||||
|
||||
EmergeManager::~EmergeManager()
|
||||
{
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++) {
|
||||
for (u32 i = 0; i != emergethread.size(); i++) {
|
||||
if (threads_active) {
|
||||
emergethread[i]->Stop();
|
||||
emergethread[i]->qevent.signal();
|
||||
@ -193,7 +193,7 @@ void EmergeManager::initMapgens()
|
||||
}
|
||||
|
||||
// Create the mapgens
|
||||
for (size_t i = 0; i != emergethread.size(); i++) {
|
||||
for (u32 i = 0; i != emergethread.size(); i++) {
|
||||
Mapgen *mg = createMapgen(params.mg_name, i, ¶ms);
|
||||
assert(mg);
|
||||
mapgen.push_back(mg);
|
||||
@ -203,7 +203,7 @@ void EmergeManager::initMapgens()
|
||||
|
||||
Mapgen *EmergeManager::getCurrentMapgen()
|
||||
{
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++) {
|
||||
for (u32 i = 0; i != emergethread.size(); i++) {
|
||||
if (emergethread[i]->IsSameThread())
|
||||
return emergethread[i]->mapgen;
|
||||
}
|
||||
@ -217,7 +217,7 @@ void EmergeManager::startThreads()
|
||||
if (threads_active)
|
||||
return;
|
||||
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++)
|
||||
for (u32 i = 0; i != emergethread.size(); i++)
|
||||
emergethread[i]->Start();
|
||||
|
||||
threads_active = true;
|
||||
@ -230,13 +230,13 @@ void EmergeManager::stopThreads()
|
||||
return;
|
||||
|
||||
// Request thread stop in parallel
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++) {
|
||||
for (u32 i = 0; i != emergethread.size(); i++) {
|
||||
emergethread[i]->Stop();
|
||||
emergethread[i]->qevent.signal();
|
||||
}
|
||||
|
||||
// Then do the waiting for each
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++)
|
||||
for (u32 i = 0; i != emergethread.size(); i++)
|
||||
emergethread[i]->Wait();
|
||||
|
||||
threads_active = false;
|
||||
@ -282,7 +282,7 @@ bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate
|
||||
|
||||
// insert into the EmergeThread queue with the least items
|
||||
int lowestitems = emergethread[0]->blockqueue.size();
|
||||
for (unsigned int i = 1; i != emergethread.size(); i++) {
|
||||
for (u32 i = 1; i != emergethread.size(); i++) {
|
||||
int nitems = emergethread[i]->blockqueue.size();
|
||||
if (nitems < lowestitems) {
|
||||
idx = i;
|
||||
|
@ -29,11 +29,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
//////////////////////// Mapgen Singlenode parameter read/write
|
||||
|
||||
void MapgenSinglenodeParams::readParams(Settings *settings) {
|
||||
void MapgenSinglenodeParams::readParams(Settings *settings)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void MapgenSinglenodeParams::writeParams(Settings *settings) {
|
||||
void MapgenSinglenodeParams::writeParams(Settings *settings)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -52,12 +54,14 @@ MapgenSinglenode::MapgenSinglenode(int mapgenid,
|
||||
}
|
||||
|
||||
|
||||
MapgenSinglenode::~MapgenSinglenode() {
|
||||
MapgenSinglenode::~MapgenSinglenode()
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////// Map generator
|
||||
|
||||
void MapgenSinglenode::makeChunk(BlockMakeData *data) {
|
||||
void MapgenSinglenode::makeChunk(BlockMakeData *data)
|
||||
{
|
||||
assert(data->vmanip);
|
||||
assert(data->nodedef);
|
||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
||||
@ -103,7 +107,8 @@ void MapgenSinglenode::makeChunk(BlockMakeData *data) {
|
||||
this->generating = false;
|
||||
}
|
||||
|
||||
int MapgenSinglenode::getGroundLevelAtPoint(v2s16 p) {
|
||||
int MapgenSinglenode::getGroundLevelAtPoint(v2s16 p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,8 @@ MapgenV5::MapgenV5(int mapgenid, MapgenParams *params, EmergeManager *emerge)
|
||||
}
|
||||
|
||||
|
||||
MapgenV5::~MapgenV5() {
|
||||
MapgenV5::~MapgenV5()
|
||||
{
|
||||
delete noise_filler_depth;
|
||||
delete noise_factor;
|
||||
delete noise_height;
|
||||
@ -127,7 +128,8 @@ MapgenV5::~MapgenV5() {
|
||||
}
|
||||
|
||||
|
||||
MapgenV5Params::MapgenV5Params() {
|
||||
MapgenV5Params::MapgenV5Params()
|
||||
{
|
||||
spflags = MGV5_BLOBS;
|
||||
|
||||
np_filler_depth = NoiseParams(0, 1, v3f(150, 150, 150), 261, 4, 0.7, 2.0);
|
||||
@ -156,7 +158,8 @@ MapgenV5Params::MapgenV5Params() {
|
||||
//#define CAVE_NOISE_THRESHOLD (1.5/CAVE_NOISE_SCALE) < original and current code
|
||||
|
||||
|
||||
void MapgenV5Params::readParams(Settings *settings) {
|
||||
void MapgenV5Params::readParams(Settings *settings)
|
||||
{
|
||||
settings->getFlagStrNoEx("mgv5_spflags", spflags, flagdesc_mapgen_v5);
|
||||
|
||||
settings->getNoiseParams("mgv5_np_filler_depth", np_filler_depth);
|
||||
@ -170,7 +173,8 @@ void MapgenV5Params::readParams(Settings *settings) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV5Params::writeParams(Settings *settings) {
|
||||
void MapgenV5Params::writeParams(Settings *settings)
|
||||
{
|
||||
settings->setFlagStr("mgv5_spflags", spflags, flagdesc_mapgen_v5, (u32)-1);
|
||||
|
||||
settings->setNoiseParams("mgv5_np_filler_depth", np_filler_depth);
|
||||
@ -184,7 +188,8 @@ void MapgenV5Params::writeParams(Settings *settings) {
|
||||
}
|
||||
|
||||
|
||||
int MapgenV5::getGroundLevelAtPoint(v2s16 p) {
|
||||
int MapgenV5::getGroundLevelAtPoint(v2s16 p)
|
||||
{
|
||||
//TimeTaker t("getGroundLevelAtPoint", NULL, PRECISION_MICRO);
|
||||
|
||||
float f = 0.55 + NoisePerlin2D(&noise_factor->np, p.X, p.Y, seed);
|
||||
@ -217,7 +222,8 @@ int MapgenV5::getGroundLevelAtPoint(v2s16 p) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV5::makeChunk(BlockMakeData *data) {
|
||||
void MapgenV5::makeChunk(BlockMakeData *data)
|
||||
{
|
||||
assert(data->vmanip);
|
||||
assert(data->nodedef);
|
||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
||||
@ -290,7 +296,8 @@ void MapgenV5::makeChunk(BlockMakeData *data) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV5::calculateNoise() {
|
||||
void MapgenV5::calculateNoise()
|
||||
{
|
||||
//TimeTaker t("calculateNoise", NULL, PRECISION_MICRO);
|
||||
int x = node_min.X;
|
||||
int y = node_min.Y - 1;
|
||||
@ -335,7 +342,8 @@ void MapgenV5::calculateNoise() {
|
||||
|
||||
|
||||
// Make base ground level
|
||||
void MapgenV5::generateBaseTerrain() {
|
||||
void MapgenV5::generateBaseTerrain()
|
||||
{
|
||||
u32 index = 0;
|
||||
u32 index2d = 0;
|
||||
|
||||
@ -374,7 +382,8 @@ void MapgenV5::generateBaseTerrain() {
|
||||
|
||||
|
||||
// Add mud and sand and others underground (in place of stone)
|
||||
void MapgenV5::generateBlobs() {
|
||||
void MapgenV5::generateBlobs()
|
||||
{
|
||||
u32 index = 0;
|
||||
|
||||
for(s16 z=node_min.Z; z<=node_max.Z; z++) {
|
||||
@ -404,7 +413,8 @@ void MapgenV5::generateBlobs() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV5::generateBiomes() {
|
||||
void MapgenV5::generateBiomes()
|
||||
{
|
||||
if (node_max.Y < water_level)
|
||||
return;
|
||||
|
||||
@ -491,7 +501,8 @@ void MapgenV5::generateBiomes() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV5::dustTopNodes() {
|
||||
void MapgenV5::dustTopNodes()
|
||||
{
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
u32 index = 0;
|
||||
|
||||
|
@ -102,11 +102,13 @@ public:
|
||||
|
||||
|
||||
struct MapgenFactoryV5 : public MapgenFactory {
|
||||
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
|
||||
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
|
||||
{
|
||||
return new MapgenV5(mgid, params, emerge);
|
||||
};
|
||||
|
||||
MapgenSpecificParams *createMapgenParams() {
|
||||
MapgenSpecificParams *createMapgenParams()
|
||||
{
|
||||
return new MapgenV5Params();
|
||||
};
|
||||
};
|
||||
|
@ -106,7 +106,8 @@ MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge)
|
||||
}
|
||||
|
||||
|
||||
MapgenV6::~MapgenV6() {
|
||||
MapgenV6::~MapgenV6()
|
||||
{
|
||||
delete noise_terrain_base;
|
||||
delete noise_terrain_higher;
|
||||
delete noise_steepness;
|
||||
@ -117,7 +118,8 @@ MapgenV6::~MapgenV6() {
|
||||
}
|
||||
|
||||
|
||||
MapgenV6Params::MapgenV6Params() {
|
||||
MapgenV6Params::MapgenV6Params()
|
||||
{
|
||||
spflags = MGV6_BIOMEBLEND | MGV6_MUDFLOW;
|
||||
freq_desert = 0.45;
|
||||
freq_beach = 0.15;
|
||||
@ -136,7 +138,8 @@ MapgenV6Params::MapgenV6Params() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6Params::readParams(Settings *settings) {
|
||||
void MapgenV6Params::readParams(Settings *settings)
|
||||
{
|
||||
settings->getFlagStrNoEx("mgv6_spflags", spflags, flagdesc_mapgen_v6);
|
||||
settings->getFloatNoEx("mgv6_freq_desert", freq_desert);
|
||||
settings->getFloatNoEx("mgv6_freq_beach", freq_beach);
|
||||
@ -155,7 +158,8 @@ void MapgenV6Params::readParams(Settings *settings) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6Params::writeParams(Settings *settings) {
|
||||
void MapgenV6Params::writeParams(Settings *settings)
|
||||
{
|
||||
settings->setFlagStr("mgv6_spflags", spflags, flagdesc_mapgen_v6, (u32)-1);
|
||||
settings->setFloat("mgv6_freq_desert", freq_desert);
|
||||
settings->setFloat("mgv6_freq_beach", freq_beach);
|
||||
@ -178,7 +182,8 @@ void MapgenV6Params::writeParams(Settings *settings) {
|
||||
|
||||
|
||||
// Returns Y one under area minimum if not found
|
||||
s16 MapgenV6::find_stone_level(v2s16 p2d) {
|
||||
s16 MapgenV6::find_stone_level(v2s16 p2d)
|
||||
{
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
s16 y_nodes_max = vm->m_area.MaxEdge.Y;
|
||||
s16 y_nodes_min = vm->m_area.MinEdge.Y;
|
||||
@ -216,7 +221,8 @@ bool MapgenV6::block_is_underground(u64 seed, v3s16 blockpos)
|
||||
//////////////////////// Base terrain height functions
|
||||
|
||||
float MapgenV6::baseTerrainLevel(float terrain_base, float terrain_higher,
|
||||
float steepness, float height_select) {
|
||||
float steepness, float height_select)
|
||||
{
|
||||
float base = 1 + terrain_base;
|
||||
float higher = 1 + terrain_higher;
|
||||
|
||||
@ -242,7 +248,8 @@ float MapgenV6::baseTerrainLevel(float terrain_base, float terrain_higher,
|
||||
}
|
||||
|
||||
|
||||
float MapgenV6::baseTerrainLevelFromNoise(v2s16 p) {
|
||||
float MapgenV6::baseTerrainLevelFromNoise(v2s16 p)
|
||||
{
|
||||
if (flags & MG_FLAT)
|
||||
return water_level;
|
||||
|
||||
@ -260,13 +267,15 @@ float MapgenV6::baseTerrainLevelFromNoise(v2s16 p) {
|
||||
}
|
||||
|
||||
|
||||
float MapgenV6::baseTerrainLevelFromMap(v2s16 p) {
|
||||
float MapgenV6::baseTerrainLevelFromMap(v2s16 p)
|
||||
{
|
||||
int index = (p.Y - node_min.Z) * ystride + (p.X - node_min.X);
|
||||
return baseTerrainLevelFromMap(index);
|
||||
}
|
||||
|
||||
|
||||
float MapgenV6::baseTerrainLevelFromMap(int index) {
|
||||
float MapgenV6::baseTerrainLevelFromMap(int index)
|
||||
{
|
||||
if (flags & MG_FLAT)
|
||||
return water_level;
|
||||
|
||||
@ -280,31 +289,36 @@ float MapgenV6::baseTerrainLevelFromMap(int index) {
|
||||
}
|
||||
|
||||
|
||||
s16 MapgenV6::find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision) {
|
||||
s16 MapgenV6::find_ground_level_from_noise(u64 seed, v2s16 p2d, s16 precision)
|
||||
{
|
||||
return baseTerrainLevelFromNoise(p2d) + AVERAGE_MUD_AMOUNT;
|
||||
}
|
||||
|
||||
|
||||
int MapgenV6::getGroundLevelAtPoint(v2s16 p) {
|
||||
int MapgenV6::getGroundLevelAtPoint(v2s16 p)
|
||||
{
|
||||
return baseTerrainLevelFromNoise(p) + AVERAGE_MUD_AMOUNT;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////// Noise functions
|
||||
|
||||
float MapgenV6::getMudAmount(v2s16 p) {
|
||||
float MapgenV6::getMudAmount(v2s16 p)
|
||||
{
|
||||
int index = (p.Y - node_min.Z) * ystride + (p.X - node_min.X);
|
||||
return getMudAmount(index);
|
||||
}
|
||||
|
||||
|
||||
bool MapgenV6::getHaveBeach(v2s16 p) {
|
||||
bool MapgenV6::getHaveBeach(v2s16 p)
|
||||
{
|
||||
int index = (p.Y - node_min.Z) * ystride + (p.X - node_min.X);
|
||||
return getHaveBeach(index);
|
||||
}
|
||||
|
||||
|
||||
BiomeV6Type MapgenV6::getBiome(v2s16 p) {
|
||||
BiomeV6Type MapgenV6::getBiome(v2s16 p)
|
||||
{
|
||||
int index = (p.Y - node_min.Z) * ystride + (p.X - node_min.X);
|
||||
return getBiome(index, p);
|
||||
}
|
||||
@ -408,7 +422,8 @@ u32 MapgenV6::get_blockseed(u64 seed, v3s16 p)
|
||||
|
||||
//////////////////////// Map generator
|
||||
|
||||
void MapgenV6::makeChunk(BlockMakeData *data) {
|
||||
void MapgenV6::makeChunk(BlockMakeData *data)
|
||||
{
|
||||
assert(data->vmanip);
|
||||
assert(data->nodedef);
|
||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
||||
@ -543,7 +558,8 @@ void MapgenV6::makeChunk(BlockMakeData *data) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6::calculateNoise() {
|
||||
void MapgenV6::calculateNoise()
|
||||
{
|
||||
int x = node_min.X;
|
||||
int z = node_min.Z;
|
||||
|
||||
@ -560,7 +576,8 @@ void MapgenV6::calculateNoise() {
|
||||
}
|
||||
|
||||
|
||||
int MapgenV6::generateGround() {
|
||||
int MapgenV6::generateGround()
|
||||
{
|
||||
//TimeTaker timer1("Generating ground level");
|
||||
MapNode n_air(CONTENT_AIR), n_water_source(c_water_source);
|
||||
MapNode n_stone(c_stone), n_desert_stone(c_desert_stone);
|
||||
@ -600,7 +617,8 @@ int MapgenV6::generateGround() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6::addMud() {
|
||||
void MapgenV6::addMud()
|
||||
{
|
||||
// 15ms @cs=8
|
||||
//TimeTaker timer1("add mud");
|
||||
MapNode n_dirt(c_dirt), n_gravel(c_gravel);
|
||||
@ -660,7 +678,8 @@ void MapgenV6::addMud() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos) {
|
||||
void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos)
|
||||
{
|
||||
// 340ms @cs=8
|
||||
TimeTaker timer1("flow mud");
|
||||
|
||||
@ -795,7 +814,8 @@ void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6::addDirtGravelBlobs() {
|
||||
void MapgenV6::addDirtGravelBlobs()
|
||||
{
|
||||
if (getBiome(v2s16(node_min.X, node_min.Z)) != BT_NORMAL)
|
||||
return;
|
||||
|
||||
@ -833,7 +853,8 @@ void MapgenV6::addDirtGravelBlobs() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6::placeTreesAndJungleGrass() {
|
||||
void MapgenV6::placeTreesAndJungleGrass()
|
||||
{
|
||||
//TimeTaker t("placeTrees");
|
||||
if (node_max.Y < water_level)
|
||||
return;
|
||||
@ -939,7 +960,8 @@ void MapgenV6::placeTreesAndJungleGrass() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6::growGrass() {
|
||||
void MapgenV6::growGrass()
|
||||
{
|
||||
for (s16 z = full_node_min.Z; z <= full_node_max.Z; z++)
|
||||
for (s16 x = full_node_min.X; x <= full_node_max.X; x++) {
|
||||
// Find the lowest surface to which enough light ends up to make
|
||||
@ -968,7 +990,8 @@ void MapgenV6::growGrass() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV6::generateCaves(int max_stone_y) {
|
||||
void MapgenV6::generateCaves(int max_stone_y)
|
||||
{
|
||||
float cave_amount = NoisePerlin2D(np_cave, node_min.X, node_min.Y, seed);
|
||||
int volume_nodes = (node_max.X - node_min.X + 1) *
|
||||
(node_max.Y - node_min.Y + 1) * MAP_BLOCKSIZE;
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
int getGroundLevelAtPoint(v2s16 p);
|
||||
|
||||
float baseTerrainLevel(float terrain_base, float terrain_higher,
|
||||
float steepness, float height_select);
|
||||
float steepness, float height_select);
|
||||
virtual float baseTerrainLevelFromNoise(v2s16 p);
|
||||
virtual float baseTerrainLevelFromMap(v2s16 p);
|
||||
virtual float baseTerrainLevelFromMap(int index);
|
||||
@ -147,11 +147,13 @@ public:
|
||||
};
|
||||
|
||||
struct MapgenFactoryV6 : public MapgenFactory {
|
||||
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
|
||||
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
|
||||
{
|
||||
return new MapgenV6(mgid, params, emerge);
|
||||
};
|
||||
|
||||
MapgenSpecificParams *createMapgenParams() {
|
||||
MapgenSpecificParams *createMapgenParams()
|
||||
{
|
||||
return new MapgenV6Params();
|
||||
};
|
||||
};
|
||||
|
@ -99,7 +99,8 @@ MapgenV7::MapgenV7(int mapgenid, MapgenParams *params, EmergeManager *emerge)
|
||||
}
|
||||
|
||||
|
||||
MapgenV7::~MapgenV7() {
|
||||
MapgenV7::~MapgenV7()
|
||||
{
|
||||
delete noise_terrain_base;
|
||||
delete noise_terrain_persist;
|
||||
delete noise_height_select;
|
||||
@ -119,7 +120,8 @@ MapgenV7::~MapgenV7() {
|
||||
}
|
||||
|
||||
|
||||
MapgenV7Params::MapgenV7Params() {
|
||||
MapgenV7Params::MapgenV7Params()
|
||||
{
|
||||
spflags = MGV7_MOUNTAINS | MGV7_RIDGES;
|
||||
|
||||
np_terrain_base = NoiseParams(4, 70, v3f(300, 300, 300), 82341, 6, 0.7, 2.0);
|
||||
@ -134,7 +136,8 @@ MapgenV7Params::MapgenV7Params() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7Params::readParams(Settings *settings) {
|
||||
void MapgenV7Params::readParams(Settings *settings)
|
||||
{
|
||||
settings->getFlagStrNoEx("mgv7_spflags", spflags, flagdesc_mapgen_v7);
|
||||
|
||||
settings->getNoiseParams("mgv7_np_terrain_base", np_terrain_base);
|
||||
@ -149,7 +152,8 @@ void MapgenV7Params::readParams(Settings *settings) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7Params::writeParams(Settings *settings) {
|
||||
void MapgenV7Params::writeParams(Settings *settings)
|
||||
{
|
||||
settings->setFlagStr("mgv7_spflags", spflags, flagdesc_mapgen_v7, (u32)-1);
|
||||
|
||||
settings->setNoiseParams("mgv7_np_terrain_base", np_terrain_base);
|
||||
@ -167,7 +171,8 @@ void MapgenV7Params::writeParams(Settings *settings) {
|
||||
///////////////////////////////////////
|
||||
|
||||
|
||||
int MapgenV7::getGroundLevelAtPoint(v2s16 p) {
|
||||
int MapgenV7::getGroundLevelAtPoint(v2s16 p)
|
||||
{
|
||||
// Base terrain calculation
|
||||
s16 y = baseTerrainLevelAtPoint(p.X, p.Y);
|
||||
|
||||
@ -193,7 +198,8 @@ int MapgenV7::getGroundLevelAtPoint(v2s16 p) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::makeChunk(BlockMakeData *data) {
|
||||
void MapgenV7::makeChunk(BlockMakeData *data)
|
||||
{
|
||||
assert(data->vmanip);
|
||||
assert(data->nodedef);
|
||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
||||
@ -263,7 +269,8 @@ void MapgenV7::makeChunk(BlockMakeData *data) {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::calculateNoise() {
|
||||
void MapgenV7::calculateNoise()
|
||||
{
|
||||
//TimeTaker t("calculateNoise", NULL, PRECISION_MICRO);
|
||||
int x = node_min.X;
|
||||
int y = node_min.Y;
|
||||
@ -296,7 +303,8 @@ void MapgenV7::calculateNoise() {
|
||||
}
|
||||
|
||||
|
||||
Biome *MapgenV7::getBiomeAtPoint(v3s16 p) {
|
||||
Biome *MapgenV7::getBiomeAtPoint(v3s16 p)
|
||||
{
|
||||
float heat = NoisePerlin2D(&noise_heat->np, p.X, p.Z, seed);
|
||||
float humidity = NoisePerlin2D(&noise_humidity->np, p.X, p.Z, seed);
|
||||
s16 groundlevel = baseTerrainLevelAtPoint(p.X, p.Z);
|
||||
@ -305,7 +313,8 @@ Biome *MapgenV7::getBiomeAtPoint(v3s16 p) {
|
||||
}
|
||||
|
||||
//needs to be updated
|
||||
float MapgenV7::baseTerrainLevelAtPoint(int x, int z) {
|
||||
float MapgenV7::baseTerrainLevelAtPoint(int x, int z)
|
||||
{
|
||||
float hselect = NoisePerlin2D(&noise_height_select->np, x, z, seed);
|
||||
hselect = rangelim(hselect, 0.0, 1.0);
|
||||
|
||||
@ -325,7 +334,8 @@ float MapgenV7::baseTerrainLevelAtPoint(int x, int z) {
|
||||
}
|
||||
|
||||
|
||||
float MapgenV7::baseTerrainLevelFromMap(int index) {
|
||||
float MapgenV7::baseTerrainLevelFromMap(int index)
|
||||
{
|
||||
float hselect = rangelim(noise_height_select->result[index], 0.0, 1.0);
|
||||
float height_base = noise_terrain_base->result[index];
|
||||
float height_alt = noise_terrain_alt->result[index];
|
||||
@ -337,7 +347,8 @@ float MapgenV7::baseTerrainLevelFromMap(int index) {
|
||||
}
|
||||
|
||||
|
||||
bool MapgenV7::getMountainTerrainAtPoint(int x, int y, int z) {
|
||||
bool MapgenV7::getMountainTerrainAtPoint(int x, int y, int z)
|
||||
{
|
||||
float mnt_h_n = NoisePerlin2D(&noise_mount_height->np, x, z, seed);
|
||||
float height_modifier = -((float)y / rangelim(mnt_h_n, 80.0, 150.0));
|
||||
float mnt_n = NoisePerlin3D(&noise_mountain->np, x, y, z, seed);
|
||||
@ -346,7 +357,8 @@ bool MapgenV7::getMountainTerrainAtPoint(int x, int y, int z) {
|
||||
}
|
||||
|
||||
|
||||
bool MapgenV7::getMountainTerrainFromMap(int idx_xyz, int idx_xz, int y) {
|
||||
bool MapgenV7::getMountainTerrainFromMap(int idx_xyz, int idx_xz, int y)
|
||||
{
|
||||
float mounthn = noise_mount_height->result[idx_xz];
|
||||
float height_modifier = -((float)y / rangelim(mounthn, 80.0, 150.0));
|
||||
return (noise_mountain->result[idx_xyz] + height_modifier >= 0.6);
|
||||
@ -388,7 +400,8 @@ void MapgenV7::carveRivers() {
|
||||
#endif
|
||||
|
||||
|
||||
int MapgenV7::generateTerrain() {
|
||||
int MapgenV7::generateTerrain()
|
||||
{
|
||||
int ymax = generateBaseTerrain();
|
||||
|
||||
if (spflags & MGV7_MOUNTAINS)
|
||||
@ -401,7 +414,8 @@ int MapgenV7::generateTerrain() {
|
||||
}
|
||||
|
||||
|
||||
int MapgenV7::generateBaseTerrain() {
|
||||
int MapgenV7::generateBaseTerrain()
|
||||
{
|
||||
MapNode n_air(CONTENT_AIR);
|
||||
MapNode n_stone(c_stone);
|
||||
MapNode n_water(c_water_source);
|
||||
@ -439,7 +453,8 @@ int MapgenV7::generateBaseTerrain() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::generateMountainTerrain() {
|
||||
void MapgenV7::generateMountainTerrain()
|
||||
{
|
||||
if (node_max.Y <= water_level)
|
||||
return;
|
||||
|
||||
@ -462,7 +477,8 @@ void MapgenV7::generateMountainTerrain() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::generateRidgeTerrain() {
|
||||
void MapgenV7::generateRidgeTerrain()
|
||||
{
|
||||
MapNode n_water(c_water_source);
|
||||
MapNode n_air(CONTENT_AIR);
|
||||
u32 index = 0;
|
||||
@ -503,7 +519,8 @@ void MapgenV7::generateRidgeTerrain() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::generateBiomes() {
|
||||
void MapgenV7::generateBiomes()
|
||||
{
|
||||
if (node_max.Y < water_level)
|
||||
return;
|
||||
|
||||
@ -597,7 +614,8 @@ void MapgenV7::generateBiomes() {
|
||||
}
|
||||
|
||||
|
||||
void MapgenV7::dustTopNodes() {
|
||||
void MapgenV7::dustTopNodes()
|
||||
{
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
u32 index = 0;
|
||||
|
||||
@ -633,7 +651,8 @@ void MapgenV7::dustTopNodes() {
|
||||
|
||||
|
||||
#if 0
|
||||
void MapgenV7::addTopNodes() {
|
||||
void MapgenV7::addTopNodes()
|
||||
{
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
s16 ntopnodes;
|
||||
u32 index = 0;
|
||||
@ -729,7 +748,8 @@ void MapgenV7::addTopNodes() {
|
||||
|
||||
NoiseParams nparams_v7_def_cave(6, 6.0, v3f(250.0, 250.0, 250.0), 34329, 3, 0.50, 2.0);
|
||||
|
||||
void MapgenV7::generateCaves(int max_stone_y) {
|
||||
void MapgenV7::generateCaves(int max_stone_y)
|
||||
{
|
||||
PseudoRandom ps(blockseed + 21343);
|
||||
|
||||
int volume_nodes = (node_max.X - node_min.X + 1) *
|
||||
|
@ -119,11 +119,13 @@ public:
|
||||
};
|
||||
|
||||
struct MapgenFactoryV7 : public MapgenFactory {
|
||||
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge) {
|
||||
Mapgen *createMapgen(int mgid, MapgenParams *params, EmergeManager *emerge)
|
||||
{
|
||||
return new MapgenV7(mgid, params, emerge);
|
||||
};
|
||||
|
||||
MapgenSpecificParams *createMapgenParams() {
|
||||
MapgenSpecificParams *createMapgenParams()
|
||||
{
|
||||
return new MapgenV7Params();
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user