#include <servermap.h>
Inheritance diagram for ServerMap:
Collaboration diagram for ServerMap:Public Member Functions | |
| ServerMap (const std::string &savedir, IGameDef *gamedef, EmergeManager *emerge, MetricsBackend *mb) | |
| ~ServerMap () | |
| MapSector * | createSector (v2s16 p) |
| bool | blockpos_over_mapgen_limit (v3s16 p) |
| bool | initBlockMake (v3s16 blockpos, BlockMakeData *data) |
| void | finishBlockMake (BlockMakeData *data, std::map< v3s16, MapBlock * > *changed_blocks) |
| MapBlock * | createBlock (v3s16 p) |
| MapBlock * | emergeBlock (v3s16 p, bool create_blank=true) override |
| MapBlock * | getBlockOrEmerge (v3s16 p3d, bool generate) |
| bool | isBlockInQueue (v3s16 pos) |
| void | addNodeAndUpdate (v3s16 p, MapNode n, std::map< v3s16, MapBlock * > &modified_blocks, bool remove_metadata) override |
| void | beginSave () override |
| void | endSave () override |
| void | save (ModifiedState save_level) override |
| void | listAllLoadableBlocks (std::vector< v3s16 > &dst) |
| void | listAllLoadedBlocks (std::vector< v3s16 > &dst) |
| MapgenParams * | getMapgenParams () |
| bool | saveBlock (MapBlock *block) override |
| MapBlock * | loadBlock (v3s16 p) |
| MapBlock * | loadBlock (const std::string &blob, v3s16 p, bool save_after_load=false) |
| Load a block that was already read from disk. | |
| bool | deleteBlock (v3s16 blockpos) override |
| void | deleteDetachedBlocks () |
| void | step () |
| void | updateVManip (v3s16 pos) |
| void | PrintInfo (std::ostream &out) override |
| bool | isSavingEnabled () |
| u64 | getSeed () |
| bool | repairBlockLight (v3s16 blockpos, std::map< v3s16, MapBlock * > *modified_blocks) |
| void | transformLiquids (std::map< v3s16, MapBlock * > &modified_blocks, ServerEnvironment *env) |
| void | transforming_liquid_add (v3s16 p) |
Public Member Functions inherited from Map | |
| Map (IGameDef *gamedef) | |
| virtual | ~Map () |
| DISABLE_CLASS_COPY (Map) | |
| void | addEventReceiver (MapEventReceiver *event_receiver) |
| void | removeEventReceiver (MapEventReceiver *event_receiver) |
| void | dispatchEvent (const MapEditEvent &event) |
| MapSector * | getSectorNoGenerateNoLock (v2s16 p2d) |
| MapSector * | getSectorNoGenerate (v2s16 p2d) |
| virtual MapSector * | emergeSector (v2s16 p) |
| MapBlock * | getBlockNoCreate (v3s16 p) |
| MapBlock * | getBlockNoCreateNoEx (v3s16 p) |
| const NodeDefManager * | getNodeDefManager () |
| bool | isValidPosition (v3s16 p) |
| void | setNode (v3s16 p, MapNode n) |
| MapNode | getNode (v3s16 p, bool *is_valid_position=NULL) |
| void | removeNodeAndUpdate (v3s16 p, std::map< v3s16, MapBlock * > &modified_blocks) |
| bool | addNodeWithEvent (v3s16 p, MapNode n, bool remove_metadata=true) |
| bool | removeNodeWithEvent (v3s16 p) |
| virtual bool | maySaveBlocks () |
| void | timerUpdate (float dtime, float unload_timeout, s32 max_loaded_blocks, std::vector< v3s16 > *unloaded_blocks=NULL) |
| void | unloadUnreferencedBlocks (std::vector< v3s16 > *unloaded_blocks=NULL) |
| void | deleteSectors (std::vector< v2s16 > &list) |
| std::vector< v3s16 > | findNodesWithMetadata (v3s16 p1, v3s16 p2) |
| NodeMetadata * | getNodeMetadata (v3s16 p) |
| bool | setNodeMetadata (v3s16 p, NodeMetadata *meta) |
| Sets metadata for a node. | |
| void | removeNodeMetadata (v3s16 p) |
| NodeTimer | getNodeTimer (v3s16 p) |
| void | setNodeTimer (const NodeTimer &t) |
| void | removeNodeTimer (v3s16 p) |
| template<typename F > | |
| void | forEachNodeInArea (v3s16 minp, v3s16 maxp, F func) |
| bool | isBlockOccluded (MapBlock *block, v3s16 cam_pos_nodes) |
| bool | isBlockOccluded (v3s16 pos_relative, v3s16 cam_pos_nodes, bool simple_check=false) |
Static Public Member Functions | |
| static MapDatabase * | createDatabase (const std::string &name, const std::string &savedir, Settings &conf) |
| static bool | saveBlock (MapBlock *block, MapDatabase *db, int compression_level=-1) |
| static void | deSerializeBlock (MapBlock *block, std::istream &is) |
Public Attributes | |
| MapSettingsManager | settings_mgr |
Protected Member Functions | |
| void | reportMetrics (u64 save_time_us, u32 saved_blocks, u32 all_blocks) override |
Protected Member Functions inherited from Map | |
| bool | determineAdditionalOcclusionCheck (v3s16 pos_camera, const core::aabbox3d< s16 > &block_bounds, v3s16 &to_check) |
| bool | isOccluded (v3s16 pos_camera, v3s16 pos_target, float step, float stepfac, float start_offset, float end_offset, u32 needed_count) |
Private Attributes | |
| EmergeManager * | m_emerge |
| std::string | m_savedir |
| bool | m_map_saving_enabled |
| int | m_map_compression_level |
| std::set< v3s16 > | m_chunks_in_progress |
| std::vector< std::unique_ptr< MapBlock > > | m_detached_blocks |
| UniqueQueue< v3s16 > | m_transforming_liquid |
| f32 | m_transforming_liquid_loop_count_multiplier = 1.0f |
| u32 | m_unprocessed_count = 0 |
| u64 | m_inc_trending_up_start_time = 0 |
| bool | m_queue_size_timer_started = false |
| bool | m_map_metadata_changed = true |
| MapDatabaseAccessor | m_db |
| MetricGaugePtr | m_loaded_blocks_gauge |
| MetricCounterPtr | m_save_time_counter |
| MetricCounterPtr | m_save_count_counter |
Friends | |
| class | ModApiMapgen |
Additional Inherited Members | |
Protected Attributes inherited from Map | |
| IGameDef * | m_gamedef |
| std::set< MapEventReceiver * > | m_event_receivers |
| std::unordered_map< v2s16, MapSector * > | m_sectors |
| MapSector * | m_sector_cache = nullptr |
| v2s16 | m_sector_cache_p |
| const NodeDefManager * | m_nodedef |
| ServerMap::ServerMap | ( | const std::string & | savedir, |
| IGameDef * | gamedef, | ||
| EmergeManager * | emerge, | ||
| MetricsBackend * | mb ) |
References MetricsBackend::addCounter(), MetricsBackend::addGauge(), createDatabase(), MapDatabaseAccessor::dbase, MapDatabaseAccessor::dbase_ro, DIR_DELIM, errorstream, Settings::exists(), FUNCTION_NAME, g_settings, Settings::get(), fs::GetDirListing(), Settings::getS16(), infostream, EmergeManager::initMap(), MapSettingsManager::loadMapMeta(), m_db, m_emerge, m_loaded_blocks_gauge, m_map_compression_level, m_map_saving_enabled, m_save_count_counter, m_save_time_counter, m_savedir, EmergeManager::map_settings_mgr, fs::PathExists(), rangelim, Settings::readConfigFile(), Settings::set(), settings_mgr, Settings::updateConfigFile(), verbosestream, and warningstream.
Here is the call graph for this function:| ServerMap::~ServerMap | ( | ) |
References MapDatabaseAccessor::dbase, MapDatabaseAccessor::dbase_ro, deleteDetachedBlocks(), errorstream, FUNCTION_NAME, infostream, m_db, m_emerge, m_map_saving_enabled, m_savedir, MOD_STATE_WRITE_AT_UNLOAD, MapDatabaseAccessor::mutex, EmergeManager::resetMap(), save(), and verbosestream.
Here is the call graph for this function:
|
overridevirtual |
Reimplemented from Map.
References Map::addNodeAndUpdate(), CONTENT_AIR, dir(), g_7dirs, NodeDefManager::get(), MapNode::getContent(), Map::getNode(), ContentFeatures::isLiquid(), Map::m_nodedef, m_transforming_liquid, p(), and UniqueQueue< Value >::push_back().
Here is the call graph for this function:
|
overridevirtual |
Reimplemented from Map.
References Database::beginSave(), MapDatabaseAccessor::dbase, m_db, and MapDatabaseAccessor::mutex.
Referenced by save().
Here is the call graph for this function:
Here is the caller graph for this function:| bool ServerMap::blockpos_over_mapgen_limit | ( | v3s16 | p | ) |
References getMapgenParams(), MAP_BLOCKSIZE, MAX_MAP_GENERATION_LIMIT, p(), and rangelim.
Referenced by initBlockMake().
Here is the call graph for this function:
Here is the caller graph for this function:References MapSector::createBlankBlock(), createSector(), MapSector::getBlockNoCreateNoEx(), infostream, and p().
Referenced by initBlockMake().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References Settings::getNoEx().
Referenced by ServerMap(), migrate_map_database(), and recompress_map_database().
Here is the call graph for this function:
Here is the caller graph for this function:References blockpos_over_max_limit(), Map::getSectorNoGenerate(), Map::m_gamedef, and Map::m_sectors.
Referenced by createBlock(), emergeBlock(), initBlockMake(), and loadBlock().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Reimplemented from Map.
References MapDatabaseAccessor::dbase, MapDatabase::deleteBlock(), MapSector::detachBlock(), Map::getBlockNoCreateNoEx(), Map::getSectorNoGenerate(), m_db, m_detached_blocks, and MapDatabaseAccessor::mutex.
Referenced by ModApiEnv::l_delete_area().
Here is the call graph for this function:
Here is the caller graph for this function:| void ServerMap::deleteDetachedBlocks | ( | ) |
References m_detached_blocks.
Referenced by ~ServerMap(), and step().
Here is the caller graph for this function:
|
static |
References MapBlock::deSerialize(), g_profiler, PRECISION_MICRO, readU8(), and SPT_AVG.
Referenced by loadBlock(), and recompress_map_database().
Here is the call graph for this function:
Here is the caller graph for this function:Reimplemented from Map.
References MapSector::createBlankBlock(), createSector(), Map::getBlockNoCreateNoEx(), loadBlock(), and p().
Referenced by ServerEnvironment::addActiveObjectRaw(), ServerEnvironment::clearObjects(), ServerEnvironment::deactivateFarObjects(), ServerEnvironment::deleteStaticFromBlock(), Server::findSpawnPos(), ServerEnvironment::findSunlight(), initBlockMake(), ServerEnvironment::removeRemovedObjects(), repairBlockLight(), and ServerEnvironment::saveStaticToBlock().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Reimplemented from Map.
References MapDatabaseAccessor::dbase, Database::endSave(), m_db, and MapDatabaseAccessor::mutex.
Referenced by save().
Here is the call graph for this function:
Here is the caller graph for this function:| void ServerMap::finishBlockMake | ( | BlockMakeData * | data, |
| std::map< v3s16, MapBlock * > * | changed_blocks ) |
References MMVManip::blitBackAll(), BlockMakeData::blockpos_max, BlockMakeData::blockpos_min, EMERGE_DBG_OUT, EmergeManager::enable_mapgen_debug_info, MapBlock::expireIsAirCache(), UniqueQueue< Value >::front(), Map::getBlockNoCreateNoEx(), m_chunks_in_progress, m_emerge, m_transforming_liquid, MOD_REASON_EXPIRE_IS_AIR, MOD_STATE_WRITE_NEEDED, UniqueQueue< Value >::pop_front(), UniqueQueue< Value >::push_back(), MapBlock::raiseModified(), MapBlock::setGenerated(), UniqueQueue< Value >::size(), BlockMakeData::transforming_liquid, BlockMakeData::vmanip, x, y, and z.
Referenced by EmergeThread::finishGen().
Here is the call graph for this function:
Here is the caller graph for this function:References EmergeManager::enqueueBlockEmerge(), Map::getBlockNoCreateNoEx(), m_emerge, and PEER_ID_INEXISTENT.
Referenced by ServerEnvironment::step().
Here is the call graph for this function:
Here is the caller graph for this function:| MapgenParams * ServerMap::getMapgenParams | ( | ) |
References MapSettingsManager::mapgen_params, and settings_mgr.
Referenced by blockpos_over_mapgen_limit(), Server::findSpawnPos(), getSeed(), and initBlockMake().
Here is the caller graph for this function:| u64 ServerMap::getSeed | ( | ) |
References getMapgenParams(), and MapgenParams::seed.
Referenced by Server::acceptAuth(), and initBlockMake().
Here is the call graph for this function:
Here is the caller graph for this function:| bool ServerMap::initBlockMake | ( | v3s16 | blockpos, |
| BlockMakeData * | data ) |
References BlockMakeData::blockpos_max, BlockMakeData::blockpos_min, blockpos_over_mapgen_limit(), MapgenParams::chunksize, createBlock(), createSector(), EMERGE_DBG_OUT, emergeBlock(), EmergeManager::enable_mapgen_debug_info, FATAL_ERROR_IF, EmergeManager::getContainingChunk(), getMapgenParams(), getSeed(), MMVManip::initialEmerge(), EmergeManager::isBlockUnderground(), m_chunks_in_progress, m_emerge, Map::m_nodedef, BlockMakeData::nodedef, p(), BlockMakeData::seed, MapBlock::setIsUnderground(), BlockMakeData::vmanip, x, y, and z.
Referenced by EmergeThread::getBlockOrStartGen().
Here is the call graph for this function:
Here is the caller graph for this function:| bool ServerMap::isBlockInQueue | ( | v3s16 | pos | ) |
References EmergeManager::isBlockInQueue(), and m_emerge.
Referenced by ServerEnvironment::getBlockStatus().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
References m_map_saving_enabled.
| void ServerMap::listAllLoadableBlocks | ( | std::vector< v3s16 > & | dst | ) |
References MapDatabaseAccessor::dbase, MapDatabaseAccessor::dbase_ro, MapDatabase::listAllLoadableBlocks(), m_db, and MapDatabaseAccessor::mutex.
Referenced by ServerEnvironment::clearObjects().
Here is the call graph for this function:
Here is the caller graph for this function:| void ServerMap::listAllLoadedBlocks | ( | std::vector< v3s16 > & | dst | ) |
References MapSector::getBlocks(), Map::m_sectors, and p().
Referenced by ServerEnvironment::clearObjects().
Here is the call graph for this function:
Here is the caller graph for this function:Load a block that was already read from disk.
Used by EmergeManager.
References MapSector::createBlankBlockNoInsert(), createSector(), deSerializeBlock(), Map::dispatchEvent(), errorstream, g_profiler, g_settings, MapSector::getBlockNoCreateNoEx(), Settings::getBool(), MapSector::insertBlock(), m_emerge, m_transforming_liquid, MEET_OTHER, EmergeManager::ndef, PRECISION_MICRO, MapBlock::resetModified(), saveBlock(), ReflowScan::scan(), SPT_AVG, MapEditEvent::type, voxalgo::update_block_border_lighting(), and BaseException::what().
Here is the call graph for this function:References g_profiler, Map::getBlockNoCreateNoEx(), MapDatabaseAccessor::loadBlock(), loadBlock(), m_db, and MapDatabaseAccessor::mutex.
Referenced by emergeBlock(), EmergeThread::getBlockOrStartGen(), and loadBlock().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
| bool ServerMap::repairBlockLight | ( | v3s16 | blockpos, |
| std::map< v3s16, MapBlock * > * | modified_blocks ) |
Fixes lighting in one map block. May modify other blocks as well, as light can spread out of the specified block. Returns false if the block is not generated (so nothing changed), true otherwise.
References emergeBlock(), MapBlock::isGenerated(), and voxalgo::repair_block_light().
Referenced by ModApiEnv::l_fix_light().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overrideprotectedvirtual |
Reimplemented from Map.
References MetricCounter::increment(), m_loaded_blocks_gauge, m_save_count_counter, m_save_time_counter, and MetricGauge::set().
Referenced by save().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Reimplemented from Map.
References Profiler::add(), beginSave(), endSave(), MapSector::getBlocks(), porting::getTimeUs(), infostream, m_map_metadata_changed, m_map_saving_enabled, Map::m_sectors, MOD_STATE_CLEAN, Profiler::print(), PrintInfo(), reportMetrics(), saveBlock(), MapSettingsManager::saveMapMeta(), settings_mgr, and warningstream.
Referenced by ~ServerMap().
Here is the call graph for this function:
Here is the caller graph for this function:
|
overridevirtual |
Reimplemented from Map.
References MapDatabaseAccessor::dbase, m_db, m_map_compression_level, MapDatabaseAccessor::mutex, and saveBlock().
Referenced by Client::handleCommand_BlockData(), loadBlock(), save(), and saveBlock().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References MapBlock::getPos(), MapBlock::resetModified(), MapDatabase::saveBlock(), SER_FMT_VER_HIGHEST_WRITE, and MapBlock::serialize().
Here is the call graph for this function:| void ServerMap::step | ( | ) |
References deleteDetachedBlocks().
Referenced by Server::AsyncRunStep().
Here is the call graph for this function:
Here is the caller graph for this function:| void ServerMap::transforming_liquid_add | ( | v3s16 | p | ) |
References m_transforming_liquid, p(), and UniqueQueue< Value >::push_back().
Here is the call graph for this function:| void ServerMap::transformLiquids | ( | std::map< v3s16, MapBlock * > & | modified_blocks, |
| ServerEnvironment * | env ) |
References ScriptApiEnv::check_for_falling(), CONTENT_AIR, CONTENT_IGNORE, ContentFeatures::floats, ContentFeatures::floodable, UniqueQueue< Value >::front(), g_settings, NodeDefManager::get(), get_max_liquid_level(), Map::getBlockNoCreateNoEx(), MapNode::getContent(), NodeDefManager::getLightingFlags(), Map::getNode(), getNodeBlockPos(), Settings::getS32(), ServerEnvironment::getScriptIface(), IRollbackManager::getSuspect(), porting::getTimeMs(), Settings::getU16(), infostream, LIGHTBANK_DAY, LIGHTBANK_NIGHT, liquid_6dirs, ContentFeatures::liquid_alternative_flowing_id, ContentFeatures::liquid_alternative_source_id, LIQUID_FLOW_DOWN_MASK, LIQUID_FLOWING, LIQUID_LEVEL_MASK, LIQUID_LEVEL_MAX, LIQUID_LEVEL_SOURCE, LIQUID_NONE, ContentFeatures::liquid_range, ContentFeatures::liquid_renewable, LIQUID_SOURCE, ContentFeatures::liquid_type, ContentFeatures::liquid_viscosity, LiquidType_END, Map::m_gamedef, m_inc_trending_up_start_time, Map::m_nodedef, m_queue_size_timer_started, m_transforming_liquid, m_unprocessed_count, NodeNeighbor::n, NEIGHBOR_LOWER, NEIGHBOR_SAME_LEVEL, NEIGHBOR_UPPER, ScriptApiNode::node_on_flood(), ScriptApiEnv::on_liquid_transformed(), NodeNeighbor::p, p(), MapNode::param2, UniqueQueue< Value >::pop_front(), UniqueQueue< Value >::push_back(), IRollbackManager::reportAction(), IGameDef::rollback(), MapNode::setContent(), MapNode::setLight(), Map::setNode(), RollbackAction::setSetNode(), UniqueQueue< Value >::size(), NodeNeighbor::t, and voxalgo::update_lighting_nodes().
Referenced by Server::AsyncRunStep().
Here is the call graph for this function:
Here is the caller graph for this function:| void ServerMap::updateVManip | ( | v3s16 | pos | ) |
References VoxelArea::contains(), EmergeManager::getCurrentMapgen(), Map::getNode(), idx, VoxelArea::index(), VoxelManipulator::m_area, VoxelManipulator::m_data, m_emerge, VoxelManipulator::m_flags, MMVManip::m_is_dirty, and Mapgen::vm.
Referenced by ServerEnvironment::removeNode(), ServerEnvironment::setNode(), and ServerEnvironment::swapNode().
Here is the call graph for this function:
Here is the caller graph for this function:
|
friend |
|
private |
Referenced by finishBlockMake(), and initBlockMake().
|
private |
Referenced by ServerMap(), ~ServerMap(), beginSave(), deleteBlock(), endSave(), listAllLoadableBlocks(), loadBlock(), and saveBlock().
|
private |
Referenced by deleteBlock(), and deleteDetachedBlocks().
|
private |
Referenced by ServerMap(), ~ServerMap(), finishBlockMake(), getBlockOrEmerge(), initBlockMake(), isBlockInQueue(), loadBlock(), and updateVManip().
|
private |
Referenced by transformLiquids().
|
private |
Referenced by ServerMap(), and reportMetrics().
|
private |
Referenced by ServerMap(), and saveBlock().
|
private |
Referenced by save().
|
private |
Referenced by ServerMap(), ~ServerMap(), isSavingEnabled(), and save().
|
private |
Referenced by transformLiquids().
|
private |
Referenced by ServerMap(), and reportMetrics().
|
private |
Referenced by ServerMap(), and reportMetrics().
|
private |
Referenced by ServerMap(), and ~ServerMap().
|
private |
Referenced by addNodeAndUpdate(), finishBlockMake(), loadBlock(), transforming_liquid_add(), and transformLiquids().
|
private |
|
private |
Referenced by transformLiquids().
| MapSettingsManager ServerMap::settings_mgr |
Referenced by ServerMap(), getMapgenParams(), and save().