mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Misc. cleanup and minor fixes
This commit is contained in:
parent
5ec5b1cbd6
commit
67c59645ec
@ -48,6 +48,8 @@ EmergeManager::EmergeManager(IGameDef *gamedef, BiomeDefManager *bdef) {
|
|||||||
this->biomedef = bdef ? bdef : new BiomeDefManager(gamedef);
|
this->biomedef = bdef ? bdef : new BiomeDefManager(gamedef);
|
||||||
this->params = NULL;
|
this->params = NULL;
|
||||||
|
|
||||||
|
mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
|
||||||
|
|
||||||
qlimit_total = g_settings->getU16("emergequeue_limit_total");
|
qlimit_total = g_settings->getU16("emergequeue_limit_total");
|
||||||
qlimit_diskonly = g_settings->getU16("emergequeue_limit_diskonly");
|
qlimit_diskonly = g_settings->getU16("emergequeue_limit_diskonly");
|
||||||
qlimit_generate = g_settings->getU16("emergequeue_limit_generate");
|
qlimit_generate = g_settings->getU16("emergequeue_limit_generate");
|
||||||
@ -209,7 +211,7 @@ u32 EmergeManager::getBlockSeed(v3s16 p) {
|
|||||||
return (u32)(params->seed & 0xFFFFFFFF) +
|
return (u32)(params->seed & 0xFFFFFFFF) +
|
||||||
p.Z * 38134234 +
|
p.Z * 38134234 +
|
||||||
p.Y * 42123 +
|
p.Y * 42123 +
|
||||||
p.Y * 23;
|
p.X * 23;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -331,10 +333,6 @@ private:
|
|||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
#define EMERGE_DBG_OUT(x) \
|
|
||||||
{ if (enable_mapgen_debug_info) \
|
|
||||||
infostream << "EmergeThread: " x << std::endl; }
|
|
||||||
|
|
||||||
bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
|
bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
|
||||||
BlockMakeData *data, bool allow_gen) {
|
BlockMakeData *data, bool allow_gen) {
|
||||||
v2s16 p2d(p.X, p.Z);
|
v2s16 p2d(p.X, p.Z);
|
||||||
@ -356,8 +354,8 @@ bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
|
|||||||
// start generation inside this same envlock
|
// start generation inside this same envlock
|
||||||
if (allow_gen && (block == NULL || !block->isGenerated())) {
|
if (allow_gen && (block == NULL || !block->isGenerated())) {
|
||||||
EMERGE_DBG_OUT("generating");
|
EMERGE_DBG_OUT("generating");
|
||||||
map->initBlockMake(data, p);
|
*b = block;
|
||||||
return true;
|
return map->initBlockMake(data, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
*b = block;
|
*b = block;
|
||||||
@ -377,14 +375,14 @@ void *EmergeThread::Thread() {
|
|||||||
|
|
||||||
map = (ServerMap *)&(m_server->m_env->getMap());
|
map = (ServerMap *)&(m_server->m_env->getMap());
|
||||||
emerge = m_server->m_emerge;
|
emerge = m_server->m_emerge;
|
||||||
mapgen = emerge->mapgen[id]; //emerge->getMapgen();
|
mapgen = emerge->mapgen[id];
|
||||||
|
enable_mapgen_debug_info = emerge->mapgen_debug_info;
|
||||||
|
|
||||||
while (getRun())
|
while (getRun())
|
||||||
try {
|
try {
|
||||||
while (!popBlockEmerge(&p, &flags)) {
|
if (!popBlockEmerge(&p, &flags)) {
|
||||||
qevent.wait();
|
qevent.wait();
|
||||||
if (!getRun())
|
continue;
|
||||||
goto exit_emerge_loop;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
last_tried_pos = p;
|
last_tried_pos = p;
|
||||||
@ -489,7 +487,6 @@ void *EmergeThread::Thread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
END_DEBUG_EXCEPTION_HANDLER(errorstream)
|
END_DEBUG_EXCEPTION_HANDLER(errorstream)
|
||||||
exit_emerge_loop:
|
|
||||||
log_deregister_thread();
|
log_deregister_thread();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
#define BLOCK_EMERGE_ALLOWGEN (1<<0)
|
#define BLOCK_EMERGE_ALLOWGEN (1<<0)
|
||||||
|
|
||||||
|
#define EMERGE_DBG_OUT(x) \
|
||||||
|
{ if (enable_mapgen_debug_info) \
|
||||||
|
infostream << "EmergeThread: " x << std::endl; }
|
||||||
|
|
||||||
class Mapgen;
|
class Mapgen;
|
||||||
class MapgenParams;
|
class MapgenParams;
|
||||||
class MapgenFactory;
|
class MapgenFactory;
|
||||||
@ -18,7 +22,6 @@ class ManualMapVoxelManipulator;
|
|||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
struct BlockMakeData {
|
struct BlockMakeData {
|
||||||
bool no_op;
|
|
||||||
ManualMapVoxelManipulator *vmanip;
|
ManualMapVoxelManipulator *vmanip;
|
||||||
u64 seed;
|
u64 seed;
|
||||||
v3s16 blockpos_min;
|
v3s16 blockpos_min;
|
||||||
@ -28,7 +31,6 @@ struct BlockMakeData {
|
|||||||
INodeDefManager *nodedef;
|
INodeDefManager *nodedef;
|
||||||
|
|
||||||
BlockMakeData():
|
BlockMakeData():
|
||||||
no_op(false),
|
|
||||||
vmanip(NULL),
|
vmanip(NULL),
|
||||||
seed(0),
|
seed(0),
|
||||||
nodedef(NULL)
|
nodedef(NULL)
|
||||||
@ -51,6 +53,7 @@ public:
|
|||||||
|
|
||||||
//settings
|
//settings
|
||||||
MapgenParams *params;
|
MapgenParams *params;
|
||||||
|
bool mapgen_debug_info;
|
||||||
u16 qlimit_total;
|
u16 qlimit_total;
|
||||||
u16 qlimit_diskonly;
|
u16 qlimit_diskonly;
|
||||||
u16 qlimit_generate;
|
u16 qlimit_generate;
|
||||||
@ -104,7 +107,6 @@ public:
|
|||||||
mapgen(NULL),
|
mapgen(NULL),
|
||||||
id(ethreadid)
|
id(ethreadid)
|
||||||
{
|
{
|
||||||
enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *Thread();
|
void *Thread();
|
||||||
|
29
src/map.cpp
29
src/map.cpp
@ -2143,14 +2143,10 @@ ServerMap::~ServerMap()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
|
bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
|
||||||
{
|
{
|
||||||
bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
|
bool enable_mapgen_debug_info = m_emerge->mapgen_debug_info;
|
||||||
if(enable_mapgen_debug_info)
|
EMERGE_DBG_OUT("initBlockMake(): " PP(blockpos) " - " PP(blockpos));
|
||||||
infostream<<"initBlockMake(): "
|
|
||||||
<<"("<<blockpos.X<<","<<blockpos.Y<<","<<blockpos.Z<<") - "
|
|
||||||
<<"("<<blockpos.X<<","<<blockpos.Y<<","<<blockpos.Z<<")"
|
|
||||||
<<std::endl;
|
|
||||||
|
|
||||||
//s16 chunksize = 3;
|
//s16 chunksize = 3;
|
||||||
//v3s16 chunk_offset(-1,-1,-1);
|
//v3s16 chunk_offset(-1,-1,-1);
|
||||||
@ -2170,12 +2166,8 @@ void ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
|
|||||||
// Do nothing if not inside limits (+-1 because of neighbors)
|
// Do nothing if not inside limits (+-1 because of neighbors)
|
||||||
if(blockpos_over_limit(blockpos_min - extra_borders) ||
|
if(blockpos_over_limit(blockpos_min - extra_borders) ||
|
||||||
blockpos_over_limit(blockpos_max + extra_borders))
|
blockpos_over_limit(blockpos_max + extra_borders))
|
||||||
{
|
return false;
|
||||||
data->no_op = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
data->no_op = false;
|
|
||||||
data->seed = m_seed;
|
data->seed = m_seed;
|
||||||
data->blockpos_min = blockpos_min;
|
data->blockpos_min = blockpos_min;
|
||||||
data->blockpos_max = blockpos_max;
|
data->blockpos_max = blockpos_max;
|
||||||
@ -2263,6 +2255,7 @@ void ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Data is ready now.
|
// Data is ready now.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapBlock* ServerMap::finishBlockMake(BlockMakeData *data,
|
MapBlock* ServerMap::finishBlockMake(BlockMakeData *data,
|
||||||
@ -2277,13 +2270,7 @@ MapBlock* ServerMap::finishBlockMake(BlockMakeData *data,
|
|||||||
|
|
||||||
v3s16 extra_borders(1,1,1);
|
v3s16 extra_borders(1,1,1);
|
||||||
|
|
||||||
if(data->no_op)
|
bool enable_mapgen_debug_info = m_emerge->mapgen_debug_info;
|
||||||
{
|
|
||||||
//infostream<<"finishBlockMake(): no-op"<<std::endl;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
|
|
||||||
|
|
||||||
/*infostream<<"Resulting vmanip:"<<std::endl;
|
/*infostream<<"Resulting vmanip:"<<std::endl;
|
||||||
data->vmanip.print(infostream);*/
|
data->vmanip.print(infostream);*/
|
||||||
@ -2311,9 +2298,7 @@ MapBlock* ServerMap::finishBlockMake(BlockMakeData *data,
|
|||||||
data->vmanip->blitBackAll(&changed_blocks);
|
data->vmanip->blitBackAll(&changed_blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(enable_mapgen_debug_info)
|
EMERGE_DBG_OUT("finishBlockMake: changed_blocks.size()=" << changed_blocks.size());
|
||||||
infostream<<"finishBlockMake: changed_blocks.size()="
|
|
||||||
<<changed_blocks.size()<<std::endl;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copy transforming liquid information
|
Copy transforming liquid information
|
||||||
|
@ -379,7 +379,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
Blocks are generated by using these and makeBlock().
|
Blocks are generated by using these and makeBlock().
|
||||||
*/
|
*/
|
||||||
void initBlockMake(BlockMakeData *data, v3s16 blockpos);
|
bool initBlockMake(BlockMakeData *data, v3s16 blockpos);
|
||||||
MapBlock *finishBlockMake(BlockMakeData *data,
|
MapBlock *finishBlockMake(BlockMakeData *data,
|
||||||
core::map<v3s16, MapBlock*> &changed_blocks);
|
core::map<v3s16, MapBlock*> &changed_blocks);
|
||||||
|
|
||||||
|
@ -432,12 +432,6 @@ int MapgenV6::getGroundLevelAtPoint(v2s16 p) {
|
|||||||
|
|
||||||
void MapgenV6::makeChunk(BlockMakeData *data)
|
void MapgenV6::makeChunk(BlockMakeData *data)
|
||||||
{
|
{
|
||||||
if(data->no_op)
|
|
||||||
{
|
|
||||||
//dstream<<"makeBlock: no-op"<<std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->generating = true;
|
this->generating = true;
|
||||||
|
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
@ -1436,4 +1430,5 @@ void MapgenV6::makeChunk(BlockMakeData *data)
|
|||||||
vmanip.spreadLight(bank, light_sources, ndef);
|
vmanip.spreadLight(bank, light_sources, ndef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this->generating = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user