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