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");
return (u32)(params->seed & 0xFFFFFFFF) +
p.Z * 38134234 +
p.Y * 42123 +
- p.Y * 23;
+ p.X * 23;
}
#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);
// 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;
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;
}
END_DEBUG_EXCEPTION_HANDLER(errorstream)
-exit_emerge_loop:
log_deregister_thread();
return NULL;
}
#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;
#include "server.h"
struct BlockMakeData {
- bool no_op;
ManualMapVoxelManipulator *vmanip;
u64 seed;
v3s16 blockpos_min;
INodeDefManager *nodedef;
BlockMakeData():
- no_op(false),
vmanip(NULL),
seed(0),
nodedef(NULL)
//settings
MapgenParams *params;
+ bool mapgen_debug_info;
u16 qlimit_total;
u16 qlimit_diskonly;
u16 qlimit_generate;
mapgen(NULL),
id(ethreadid)
{
- enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
}
void *Thread();
#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);
// 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;
}
// Data is ready now.
+ return true;
}
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);*/
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
/*
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);
void MapgenV6::makeChunk(BlockMakeData *data)
{
- if(data->no_op)
- {
- //dstream<<"makeBlock: no-op"<<std::endl;
- return;
- }
-
this->generating = true;
assert(data->vmanip);
vmanip.spreadLight(bank, light_sources, ndef);
}
}
+ this->generating = false;
}