Minetest  5.4.0
EmergeManager Class Reference

#include <emerge.h>

+ Collaboration diagram for EmergeManager:

Public Member Functions

 EmergeManager (Server *server)
 
 ~EmergeManager ()
 
 DISABLE_CLASS_COPY (EmergeManager)
 
const BiomeManagergetBiomeManager () const
 
const OreManagergetOreManager () const
 
const DecorationManagergetDecorationManager () const
 
const SchematicManagergetSchematicManager () const
 
BiomeManagergetWritableBiomeManager ()
 
OreManagergetWritableOreManager ()
 
DecorationManagergetWritableDecorationManager ()
 
SchematicManagergetWritableSchematicManager ()
 
void initMapgens (MapgenParams *mgparams)
 
void startThreads ()
 
void stopThreads ()
 
bool isRunning ()
 
bool enqueueBlockEmerge (session_t peer_id, v3s16 blockpos, bool allow_generate, bool ignore_queue_limits=false)
 
bool enqueueBlockEmergeEx (v3s16 blockpos, session_t peer_id, u16 flags, EmergeCompletionCallback callback, void *callback_param)
 
v3s16 getContainingChunk (v3s16 blockpos)
 
MapgengetCurrentMapgen ()
 
int getSpawnLevelAtPoint (v2s16 p)
 
int getGroundLevelAtPoint (v2s16 p)
 
bool isBlockUnderground (v3s16 blockpos)
 

Static Public Member Functions

static v3s16 getContainingChunk (v3s16 blockpos, s16 chunksize)
 

Public Attributes

const NodeDefManagerndef
 
bool enable_mapgen_debug_info
 
u32 gen_notify_on = 0
 
std::set< u32 > gen_notify_on_deco_ids
 
MapgenParamsmgparams
 
MapSettingsManagermap_settings_mgr
 

Private Member Functions

EmergeThreadgetOptimalThread ()
 
bool pushBlockEmergeData (v3s16 pos, u16 peer_requested, u16 flags, EmergeCompletionCallback callback, void *callback_param, bool *entry_already_exists)
 
bool popBlockEmergeData (v3s16 pos, BlockEmergeData *bedata)
 

Private Attributes

std::vector< Mapgen * > m_mapgens
 
std::vector< EmergeThread * > m_threads
 
bool m_threads_active = false
 
std::mutex m_queue_mutex
 
std::map< v3s16, BlockEmergeDatam_blocks_enqueued
 
std::unordered_map< u16, u16 > m_peer_queue_count
 
u16 m_qlimit_total
 
u16 m_qlimit_diskonly
 
u16 m_qlimit_generate
 
BiomeManagerbiomemgr
 
OreManageroremgr
 
DecorationManagerdecomgr
 
SchematicManagerschemmgr
 

Friends

class ModApiMapgen
 
class EmergeThread
 

Constructor & Destructor Documentation

◆ EmergeManager()

EmergeManager::EmergeManager ( Server server)

References biomemgr, decomgr, enable_mapgen_debug_info, g_settings, Settings::getBool(), Server::getNodeDefManager(), Thread::getNumberOfProcessors(), Settings::getS16NoEx(), Settings::getU16(), Settings::getU16NoEx(), infostream, m_qlimit_diskonly, m_qlimit_generate, m_qlimit_total, m_threads, ndef, oremgr, and schemmgr.

+ Here is the call graph for this function:

◆ ~EmergeManager()

EmergeManager::~EmergeManager ( )

References biomemgr, decomgr, m_mapgens, m_threads, m_threads_active, oremgr, schemmgr, EmergeThread::signal(), Thread::stop(), and Thread::wait().

+ Here is the call graph for this function:

Member Function Documentation

◆ DISABLE_CLASS_COPY()

EmergeManager::DISABLE_CLASS_COPY ( EmergeManager  )

◆ enqueueBlockEmerge()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ enqueueBlockEmergeEx()

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 ModApiEnvMod::l_emerge_area().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBiomeManager()

const BiomeManager* EmergeManager::getBiomeManager ( ) const
inline

References biomemgr.

Referenced by ModApiMapgen::l_get_biome_data(), ModApiMapgen::l_get_biome_id(), ModApiMapgen::l_get_biome_name(), ModApiMapgen::l_get_heat(), and ModApiMapgen::l_get_humidity().

+ Here is the caller graph for this function:

◆ getContainingChunk() [1/2]

v3s16 EmergeManager::getContainingChunk ( v3s16  blockpos)

References MapgenParams::chunksize, and mgparams.

Referenced by ServerMap::initBlockMake().

+ Here is the caller graph for this function:

◆ getContainingChunk() [2/2]

v3s16 EmergeManager::getContainingChunk ( v3s16  blockpos,
s16  chunksize 
)
static

References getContainerPos().

+ Here is the call graph for this function:

◆ getCurrentMapgen()

Mapgen * EmergeManager::getCurrentMapgen ( )

References Thread::isCurrentThread(), Thread::isRunning(), EmergeThread::m_mapgen, m_threads, and m_threads_active.

Referenced by ModApiMapgen::l_get_mapgen_object(), and ServerMap::updateVManip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDecorationManager()

const DecorationManager* EmergeManager::getDecorationManager ( ) const
inline

References decomgr.

Referenced by ModApiMapgen::l_get_decoration_id().

+ Here is the caller graph for this function:

◆ getGroundLevelAtPoint()

int EmergeManager::getGroundLevelAtPoint ( v2s16  p)

References errorstream, m_mapgens, and p().

+ Here is the call graph for this function:

◆ getOptimalThread()

EmergeThread * EmergeManager::getOptimalThread ( )
private

References FATAL_ERROR_IF, and m_threads.

Referenced by enqueueBlockEmergeEx().

+ Here is the caller graph for this function:

◆ getOreManager()

const OreManager* EmergeManager::getOreManager ( ) const
inline

References oremgr.

◆ getSchematicManager()

const SchematicManager* EmergeManager::getSchematicManager ( ) const
inline

References schemmgr.

Referenced by ModApiMapgen::l_read_schematic(), and ModApiMapgen::l_serialize_schematic().

+ Here is the caller graph for this function:

◆ getSpawnLevelAtPoint()

int EmergeManager::getSpawnLevelAtPoint ( v2s16  p)

References errorstream, m_mapgens, and p().

Referenced by Server::findSpawnPos(), and ModApiMapgen::l_get_spawn_level().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWritableBiomeManager()

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().

+ Here is the caller graph for this function:

◆ getWritableDecorationManager()

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().

+ Here is the caller graph for this function:

◆ getWritableOreManager()

OreManager * EmergeManager::getWritableOreManager ( )

References FATAL_ERROR_IF, m_mapgens, and oremgr.

Referenced by ModApiMapgen::l_clear_registered_ores(), and ModApiMapgen::l_register_ore().

+ Here is the caller graph for this function:

◆ getWritableSchematicManager()

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().

+ Here is the caller graph for this function:

◆ initMapgens()

void EmergeManager::initMapgens ( MapgenParams mgparams)

References biomemgr, Mapgen::createMapgen(), decomgr, FATAL_ERROR_IF, infostream, m_mapgens, m_threads, mgparams, oremgr, p(), params, and schemmgr.

Referenced by Server::init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isBlockUnderground()

bool EmergeManager::isBlockUnderground ( v3s16  blockpos)

References MAP_BLOCKSIZE, mgparams, and MapgenParams::water_level.

Referenced by ServerMap::initBlockMake().

+ Here is the caller graph for this function:

◆ isRunning()

bool EmergeManager::isRunning ( )

References m_threads_active.

◆ popBlockEmergeData()

bool EmergeManager::popBlockEmergeData ( v3s16  pos,
BlockEmergeData bedata 
)
private

References m_blocks_enqueued, m_peer_queue_count, and BlockEmergeData::peer_requested.

Referenced by EmergeThread::cancelPendingItems(), and EmergeThread::popBlockEmerge().

+ Here is the caller graph for this function:

◆ pushBlockEmergeData()

bool EmergeManager::pushBlockEmergeData ( v3s16  pos,
u16  peer_requested,
u16  flags,
EmergeCompletionCallback  callback,
void *  callback_param,
bool *  entry_already_exists 
)
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().

+ Here is the caller graph for this function:

◆ startThreads()

void EmergeManager::startThreads ( )

References m_threads, and m_threads_active.

Referenced by Server::AsyncRunStep().

+ Here is the caller graph for this function:

◆ stopThreads()

void EmergeManager::stopThreads ( )

References m_threads, and m_threads_active.

Referenced by Server::~Server().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ EmergeThread

friend class EmergeThread
friend

◆ ModApiMapgen

friend class ModApiMapgen
friend

Member Data Documentation

◆ biomemgr

◆ decomgr

◆ enable_mapgen_debug_info

bool EmergeManager::enable_mapgen_debug_info

◆ gen_notify_on

u32 EmergeManager::gen_notify_on = 0

◆ gen_notify_on_deco_ids

std::set<u32> EmergeManager::gen_notify_on_deco_ids

◆ m_blocks_enqueued

std::map<v3s16, BlockEmergeData> EmergeManager::m_blocks_enqueued
private

◆ m_mapgens

◆ m_peer_queue_count

std::unordered_map<u16, u16> EmergeManager::m_peer_queue_count
private

◆ m_qlimit_diskonly

u16 EmergeManager::m_qlimit_diskonly
private

◆ m_qlimit_generate

u16 EmergeManager::m_qlimit_generate
private

◆ m_qlimit_total

u16 EmergeManager::m_qlimit_total
private

◆ m_queue_mutex

std::mutex EmergeManager::m_queue_mutex
private

◆ m_threads

std::vector<EmergeThread *> EmergeManager::m_threads
private

◆ m_threads_active

bool EmergeManager::m_threads_active = false
private

◆ map_settings_mgr

◆ mgparams

◆ ndef

const NodeDefManager* EmergeManager::ndef

◆ oremgr

◆ schemmgr


The documentation for this class was generated from the following files: