#include <emerge.h>
Static Public Member Functions | |
static v3s16 | getContainingChunk (v3s16 blockpos, s16 chunksize) |
Public Attributes | |
const NodeDefManager * | ndef |
bool | enable_mapgen_debug_info |
u32 | gen_notify_on = 0 |
std::set< u32 > | gen_notify_on_deco_ids |
std::set< std::string > | gen_notify_on_custom |
MapgenParams * | mgparams |
MapSettingsManager * | map_settings_mgr |
Private Member Functions | |
EmergeThread * | getOptimalThread () |
bool | pushBlockEmergeData (v3s16 pos, u16 peer_requested, u16 flags, EmergeCompletionCallback callback, void *callback_param, bool *entry_already_exists) |
bool | popBlockEmergeData (v3s16 pos, BlockEmergeData *bedata) |
void | reportCompletedEmerge (EmergeAction action) |
Private Attributes | |
std::vector< Mapgen * > | m_mapgens |
std::vector< EmergeThread * > | m_threads |
bool | m_threads_active = false |
MapDatabaseAccessor * | m_db = nullptr |
std::mutex | m_queue_mutex |
std::map< v3s16, BlockEmergeData > | m_blocks_enqueued |
std::unordered_map< u16, u32 > | m_peer_queue_count |
u32 | m_qlimit_total |
u32 | m_qlimit_diskonly |
u32 | m_qlimit_generate |
MetricCounterPtr | m_completed_emerge_counter [5] |
BiomeGen * | biomegen |
BiomeManager * | biomemgr |
OreManager * | oremgr |
DecorationManager * | decomgr |
SchematicManager * | schemmgr |
Friends | |
class | ModApiMapgen |
class | EmergeThread |
EmergeManager::EmergeManager | ( | Server * | server, |
MetricsBackend * | mb ) |
References MetricsBackend::addCounter(), ARRLEN, biomegen, biomemgr, decomgr, emergeActionStrs, enable_mapgen_debug_info, g_settings, Settings::getBool(), Server::getNodeDefManager(), Thread::getNumberOfProcessors(), Settings::getS16NoEx(), Settings::getU32(), Settings::getU32NoEx(), infostream, m_completed_emerge_counter, m_qlimit_diskonly, m_qlimit_generate, m_qlimit_total, m_threads, mgparams, ndef, oremgr, rangelim, and schemmgr.
EmergeManager::~EmergeManager | ( | ) |
References biomegen, biomemgr, decomgr, m_mapgens, m_threads, m_threads_active, oremgr, schemmgr, EmergeThread::signal(), Thread::stop(), and Thread::wait().
EmergeManager::DISABLE_CLASS_COPY | ( | EmergeManager | ) |
bool EmergeManager::enqueueBlockEmerge | ( | session_t | peer_id, |
v3s16 | blockpos, | ||
bool | allow_generate, | ||
bool | ignore_queue_limits = false ) |
References BLOCK_EMERGE_ALLOW_GEN, BLOCK_EMERGE_FORCE_QUEUE, and enqueueBlockEmergeEx().
Referenced by ServerMap::getBlockOrEmerge(), RemoteClient::GetNextBlocks(), and Server::handleCommand_Interact().
bool EmergeManager::enqueueBlockEmergeEx | ( | v3s16 | blockpos, |
session_t | peer_id, | ||
u16 | flags, | ||
EmergeCompletionCallback | callback, | ||
void * | callback_param ) |
References getOptimalThread(), m_queue_mutex, EmergeThread::pushBlock(), pushBlockEmergeData(), and EmergeThread::signal().
Referenced by enqueueBlockEmerge(), and ModApiEnv::l_emerge_area().
|
inline |
References biomegen.
Referenced by ModApiMapgen::getBiomeGen().
|
inline |
References biomemgr.
Referenced by ModApiMapgen::l_get_biome_id(), and ModApiMapgen::l_get_biome_name().
References getContainerPos().
Referenced by ServerMap::initBlockMake().
Mapgen * EmergeManager::getCurrentMapgen | ( | ) |
References Thread::isCurrentThread(), Thread::isRunning(), EmergeThread::m_mapgen, m_threads, and m_threads_active.
Referenced by ModApiMapgen::getMapgen(), and ServerMap::updateVManip().
|
inline |
References decomgr.
Referenced by ModApiMapgen::l_get_decoration_id().
|
private |
References FATAL_ERROR_IF, and m_threads.
Referenced by enqueueBlockEmergeEx().
|
inline |
References oremgr.
size_t EmergeManager::getQueueSize | ( | ) |
References m_blocks_enqueued, and m_queue_mutex.
Referenced by Server::yieldToOtherThreads().
|
inline |
References schemmgr.
Referenced by ModApiMapgen::l_read_schematic(), and ModApiMapgen::l_serialize_schematic().
int EmergeManager::getSpawnLevelAtPoint | ( | v2s16 | p | ) |
References errorstream, m_mapgens, and p().
Referenced by Server::findSpawnPos(), and ModApiMapgen::l_get_spawn_level().
BiomeManager * EmergeManager::getWritableBiomeManager | ( | ) |
References biomemgr, FATAL_ERROR_IF, and m_mapgens.
Referenced by ModApiMapgen::l_clear_registered_biomes(), ModApiMapgen::l_register_biome(), ModApiMapgen::l_register_decoration(), and ModApiMapgen::l_register_ore().
DecorationManager * EmergeManager::getWritableDecorationManager | ( | ) |
References decomgr, FATAL_ERROR_IF, and m_mapgens.
Referenced by BiomeManager::clear(), SchematicManager::clear(), ModApiMapgen::l_clear_registered_decorations(), and ModApiMapgen::l_register_decoration().
OreManager * EmergeManager::getWritableOreManager | ( | ) |
References FATAL_ERROR_IF, m_mapgens, and oremgr.
Referenced by ModApiMapgen::l_clear_registered_ores(), and ModApiMapgen::l_register_ore().
SchematicManager * EmergeManager::getWritableSchematicManager | ( | ) |
References FATAL_ERROR_IF, m_mapgens, and schemmgr.
Referenced by ModApiMapgen::l_clear_registered_schematics(), ModApiMapgen::l_register_decoration(), and ModApiMapgen::l_register_schematic().
void EmergeManager::initMap | ( | MapDatabaseAccessor * | holder | ) |
holder | non-owned reference that must stay alive |
References MapDatabaseAccessor::dbase, FATAL_ERROR_IF, and m_db.
Referenced by ServerMap::ServerMap().
void EmergeManager::initMapgens | ( | MapgenParams * | mgparams | ) |
References biomegen, BIOMEGEN_ORIGINAL, biomemgr, MapgenParams::bparams, MapgenParams::chunksize, BiomeManager::createBiomeGen(), Mapgen::createMapgen(), decomgr, FATAL_ERROR_IF, infostream, m_mapgens, m_threads, MAP_BLOCKSIZE, mgparams, MapgenParams::mgtype, oremgr, p(), and schemmgr.
Referenced by Server::init().
bool EmergeManager::isBlockInQueue | ( | v3s16 | pos | ) |
References m_blocks_enqueued, and m_queue_mutex.
Referenced by ServerMap::isBlockInQueue().
bool EmergeManager::isBlockUnderground | ( | v3s16 | blockpos | ) |
References MAP_BLOCKSIZE, mgparams, and MapgenParams::water_level.
Referenced by ServerMap::initBlockMake().
bool EmergeManager::isRunning | ( | ) |
References m_threads_active.
|
private |
References m_blocks_enqueued, m_peer_queue_count, and BlockEmergeData::peer_requested.
Referenced by EmergeThread::cancelPendingItems(), and EmergeThread::popBlockEmerge().
|
private |
References BLOCK_EMERGE_ALLOW_GEN, BLOCK_EMERGE_FORCE_QUEUE, BlockEmergeData::callbacks, BlockEmergeData::flags, m_blocks_enqueued, m_peer_queue_count, m_qlimit_diskonly, m_qlimit_generate, m_qlimit_total, PEER_ID_INEXISTENT, and BlockEmergeData::peer_requested.
Referenced by enqueueBlockEmergeEx().
|
private |
References ARRLEN, and m_completed_emerge_counter.
Referenced by EmergeThread::runCompletionCallbacks().
void EmergeManager::resetMap | ( | ) |
resets the reference
References FATAL_ERROR_IF, m_db, and m_threads_active.
Referenced by ServerMap::~ServerMap().
void EmergeManager::startThreads | ( | ) |
References m_threads, and m_threads_active.
Referenced by Server::AsyncRunStep().
void EmergeManager::stopThreads | ( | ) |
References m_threads, and m_threads_active.
Referenced by Server::~Server().
|
friend |
|
friend |
|
private |
Referenced by EmergeManager(), ~EmergeManager(), getBiomeGen(), and initMapgens().
|
private |
Referenced by EmergeManager(), ~EmergeManager(), getBiomeManager(), getWritableBiomeManager(), and initMapgens().
|
private |
Referenced by EmergeManager(), ~EmergeManager(), getDecorationManager(), getWritableDecorationManager(), and initMapgens().
bool EmergeManager::enable_mapgen_debug_info |
Referenced by EmergeManager(), ServerMap::finishBlockMake(), ServerMap::initBlockMake(), and EmergeThread::run().
u32 EmergeManager::gen_notify_on = 0 |
Referenced by ModApiMapgen::l_set_gen_notify().
std::set<std::string> EmergeManager::gen_notify_on_custom |
Referenced by ModApiMapgen::l_set_gen_notify().
std::set<u32> EmergeManager::gen_notify_on_deco_ids |
Referenced by ModApiMapgen::l_set_gen_notify().
|
private |
Referenced by getQueueSize(), isBlockInQueue(), popBlockEmergeData(), and pushBlockEmergeData().
|
private |
Referenced by EmergeManager(), and reportCompletedEmerge().
|
private |
Referenced by initMap(), resetMap(), and EmergeThread::run().
|
private |
|
private |
Referenced by popBlockEmergeData(), and pushBlockEmergeData().
|
private |
Referenced by EmergeManager(), and pushBlockEmergeData().
|
private |
Referenced by EmergeManager(), and pushBlockEmergeData().
|
private |
Referenced by EmergeManager(), and pushBlockEmergeData().
|
private |
|
private |
Referenced by EmergeManager(), ~EmergeManager(), getCurrentMapgen(), getOptimalThread(), initMapgens(), startThreads(), and stopThreads().
|
private |
Referenced by ~EmergeManager(), getCurrentMapgen(), isRunning(), resetMap(), startThreads(), and stopThreads().
MapSettingsManager* EmergeManager::map_settings_mgr |
Referenced by ServerMap::ServerMap(), ModApiMapgen::l_get_mapgen_edges(), ModApiMapgen::l_get_mapgen_params(), ModApiMapgen::l_get_mapgen_setting(), ModApiMapgen::l_get_mapgen_setting_noiseparams(), ModApiMapgen::l_set_mapgen_params(), ModApiMapgen::l_set_mapgen_setting(), and ModApiMapgen::l_set_mapgen_setting_noiseparams().
MapgenParams* EmergeManager::mgparams |
Referenced by EmergeManager(), Server::AsyncRunStep(), initMapgens(), and isBlockUnderground().
const NodeDefManager* EmergeManager::ndef |
Referenced by EmergeManager(), and ServerMap::loadBlock().
|
private |
Referenced by EmergeManager(), ~EmergeManager(), getOreManager(), getWritableOreManager(), and initMapgens().
|
private |