Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
EmergeManager Class Reference

#include <emerge.h>

+ Collaboration diagram for EmergeManager:

Public Member Functions

 EmergeManager (Server *server, MetricsBackend *mb)
 
 ~EmergeManager ()
 
 DISABLE_CLASS_COPY (EmergeManager)
 
const BiomeGengetBiomeGen () const
 
const BiomeManagergetBiomeManager () const
 
const OreManagergetOreManager () const
 
const DecorationManagergetDecorationManager () const
 
const SchematicManagergetSchematicManager () const
 
BiomeManagergetWritableBiomeManager ()
 
OreManagergetWritableOreManager ()
 
DecorationManagergetWritableDecorationManager ()
 
SchematicManagergetWritableSchematicManager ()
 
void initMapgens (MapgenParams *mgparams)
 
void initMap (MapDatabaseAccessor *holder)
 
void resetMap ()
 resets the reference
 
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)
 
size_t getQueueSize ()
 
bool isBlockInQueue (v3s16 pos)
 
MapgengetCurrentMapgen ()
 
int getSpawnLevelAtPoint (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
 
std::set< std::string > gen_notify_on_custom
 
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)
 
void reportCompletedEmerge (EmergeAction action)
 

Private Attributes

std::vector< Mapgen * > m_mapgens
 
std::vector< EmergeThread * > m_threads
 
bool m_threads_active = false
 
MapDatabaseAccessorm_db = nullptr
 
std::mutex m_queue_mutex
 
std::map< v3s16, BlockEmergeDatam_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]
 
BiomeGenbiomegen
 
BiomeManagerbiomemgr
 
OreManageroremgr
 
DecorationManagerdecomgr
 
SchematicManagerschemmgr
 

Friends

class ModApiMapgen
 
class EmergeThread
 

Constructor & Destructor Documentation

◆ EmergeManager()

◆ ~EmergeManager()

EmergeManager::~EmergeManager ( )

References biomegen, 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 ModApiEnv::l_emerge_area().

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

◆ getBiomeGen()

const BiomeGen * EmergeManager::getBiomeGen ( ) const
inline

References biomegen.

Referenced by ModApiMapgen::getBiomeGen().

+ Here is the caller graph for this function:

◆ getBiomeManager()

const BiomeManager * EmergeManager::getBiomeManager ( ) const
inline

References biomemgr.

Referenced by ModApiMapgen::l_get_biome_id(), and ModApiMapgen::l_get_biome_name().

+ Here is the caller graph for this function:

◆ getContainingChunk()

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

References getContainerPos().

Referenced by ServerMap::initBlockMake().

+ Here is the call graph for this function:
+ Here is the caller 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::getMapgen(), 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:

◆ 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.

◆ getQueueSize()

size_t EmergeManager::getQueueSize ( )

References m_blocks_enqueued, and m_queue_mutex.

Referenced by Server::yieldToOtherThreads().

+ Here is the caller graph for this function:

◆ 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:

◆ initMap()

void EmergeManager::initMap ( MapDatabaseAccessor * holder)
Parameters
holdernon-owned reference that must stay alive

References MapDatabaseAccessor::dbase, FATAL_ERROR_IF, and m_db.

Referenced by ServerMap::ServerMap().

+ Here is the caller graph for this function:

◆ initMapgens()

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

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

◆ isBlockInQueue()

bool EmergeManager::isBlockInQueue ( v3s16 pos)

References m_blocks_enqueued, and m_queue_mutex.

Referenced by ServerMap::isBlockInQueue().

+ 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:

◆ reportCompletedEmerge()

void EmergeManager::reportCompletedEmerge ( EmergeAction action)
private

References ARRLEN, and m_completed_emerge_counter.

Referenced by EmergeThread::runCompletionCallbacks().

+ Here is the caller graph for this function:

◆ resetMap()

void EmergeManager::resetMap ( )

resets the reference

References FATAL_ERROR_IF, m_db, and m_threads_active.

Referenced by ServerMap::~ServerMap().

+ 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 Symbol Documentation

◆ EmergeThread

friend class EmergeThread
friend

◆ ModApiMapgen

friend class ModApiMapgen
friend

Member Data Documentation

◆ biomegen

BiomeGen* EmergeManager::biomegen
private

◆ biomemgr

◆ decomgr

◆ enable_mapgen_debug_info

bool EmergeManager::enable_mapgen_debug_info

◆ gen_notify_on

u32 EmergeManager::gen_notify_on = 0

◆ gen_notify_on_custom

std::set<std::string> EmergeManager::gen_notify_on_custom

◆ 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_completed_emerge_counter

MetricCounterPtr EmergeManager::m_completed_emerge_counter[5]
private

◆ m_db

MapDatabaseAccessor* EmergeManager::m_db = nullptr
private

◆ m_mapgens

◆ m_peer_queue_count

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

◆ m_qlimit_diskonly

u32 EmergeManager::m_qlimit_diskonly
private

◆ m_qlimit_generate

u32 EmergeManager::m_qlimit_generate
private

◆ m_qlimit_total

u32 EmergeManager::m_qlimit_total
private

◆ m_queue_mutex

◆ 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: