aboutsummaryrefslogtreecommitdiff
path: root/src/map.cpp
AgeCommit message (Collapse)Author
2017-08-20Modernize code: very last fixes (#6290)Loïc Blot
Last modernization fixes
2017-08-19ServerMap saving: cleanups (#6274)Loïc Blot
* remove sector meta loading/saving from files which targets dead code (differs_from_disk is always empty) * this remove empty ServerMapSector and ClientMapSector, remove MapSector childs
2017-08-19Code modernization: src/m* (part 3)Loic Blot
* empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * remove some unused headers in some cpp variable
2017-08-19Code modernization: src/m* (part 2)Loic Blot
* empty function * default constructor/destructor * remove unused Map::emergeSector(a,b) * for range-based loops * migrate a dirs[7] table to direction tables * remove various old unused function
2017-08-18Modernize various files (src/m*) (#6267)Loïc Blot
* Modernize various files (src/m*) * range-based for loops * code style * C++ headers instead of C headers * Default operators * empty function Thanks to clang-tidy
2017-07-26Remove unused Map::getDayNightDiff + fix one undefined variable in mapblock.cppLoic Blot
2017-06-17Cpp11 initializers 2 (#5999)Loïc Blot
* C++11 patchset 10: continue cleanup on constructors * Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop) * More classes cleanup * More classes cleanup + change NULL tests to boolean tests
2017-06-03Properly remove SAO when worldedges are overtaken (#5889)Loïc Blot
* LuaEntitySAO: Remove beyond outermost mapchunk edges Based on a commit by, and with help from, nerzhul. Add 2 functions to class Mapgen: A function to calculate actual mapgen edges, called from the Mapgen constructor. A function called indirectly from content_sao.cpp per entity step to check SAO position is within mapgen edges. * Calculate borders from params not mapgen, which is not available everytime
2017-05-26Time: Change old `u32` timestamps to 64-bit (#5818)SmallJoker
MacOSX build fix + cleanups
2017-04-28Clean up getTime helpersShadowNinja
This increases size of the getTime return values to 64 bits. It also removes the TimeGetter classes since the getTime functions are now very precise.
2017-04-25Rename Scripting API files for consistencyShadowNinja
2017-04-23Player data to Database (#5475)Loïc Blot
* Player data to Database Add player data into databases (SQLite3 & PG only) PostgreSQL & SQLite: better POO Design for databases Add --migrate-players argument to server + deprecation warning * Remove players directory if empty
2017-04-22Add on_flood() callback.Auke Kok
This callback is called if a liquid definitely floods a non-air node on the map. The callback arguments are (pos, oldnode, newnode) and can return a `bool` value indicating whether flooding the node should be cancelled (`return true` will prevent the node from flooding). Documentation is added, the callback function was tested with a modified minetest_game. Note that `return true` will likely cause the node's `on_flood()` callback to be called every second until the node gets removed, so care must be taken to prevent many callbacks from using this return value. The current default liquid update interval is 1.0 seconds, which isn't unmanageable. The larger aim of this patch is to remove the lava cooling ABM, which is a significant cost to idle servers that have lava on their map. This callback will be much more efficient.
2017-04-20Light update for map blocksDániel Juhász
This is not really different from the light update of a voxel manipulator. This update does not assume that the lighting was correct before, therefore it is useful for correction. Also expose this function to the Lua API for light correction, and allow voxel manipulators not to update the light.
2017-04-20Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)Loïc Blot
* Also remove 2 non declared but defined functions * Make some functions around const ref changes const
2017-04-19Fix various variables passed by copy instead of const ref (#5610)Loïc Blot
Pointed by cppcheck
2017-03-27Map generation limit: Make per-worldparamat
The setting limits map generation but affects nothing else. Add 'mapgen_limit' to global mapgen parameters. Move 'blockpos_over_mapgen_limit()' to the only place it is called from: map.cpp. Allow teleportation to any part of the world even if over the set mapgen limit. Simplify the reading of this limit in mgvalleys. Remove the 'map_generation_limit' setting.
2017-03-20Map generation limit: Rewriteparamat
The previous implementation applied the setting to blockpos_over_limit(), objectpos_over_limit() and in createSector(), causing many bugs near the world edge. First revert the previous implementation. Rename blockpos_over_limit() to blockpos_over_max_limit() for clarity. Add a new function to mapblock.h called blockpos_over_mapgen_limit() that checks against the map_generation_limit setting, and call this only from the code that decides where mapgen stops. Use MAX_MAP_GENERATION_LIMIT in objectpos_over_limit() to reduce the chance of bugs, there is no need to use map_generation_limit here.
2017-03-19Update server min protocol version to v24 (#5411)Loïc Blot
* Update server min protocol version to v24 It's based on @sfan5 stats. See https://kitsunemimi.pw/tmp/serverlist_stats_2017-03-17.txt v24 was bumped 25/08/14 and 0.4.11 was released 25/12/14 * Drop protocol v23 and lesser code
2017-03-11Allow server side occlusion culling.Lars Hofhansl
2017-03-11Light calculation: New bulk node lighting codeDániel Juhász
This commit introduces a new bulk node lighting algorithm to minimize lighting bugs during l-system tree generation, schematic placement and non-mapgen-object lua voxelmanip light calculation. If the block above the changed area is not loaded, it gets loaded to avoid lighting bugs. Light is updated as soon as write_to_map is called on a voxel manipulator, therefore update_map does nothing.
2017-02-18Voxelmanip: Do not emerge or blit to blocks over map gen limitparamat
Placing a structure that extends into mapblocks that extend past map_gen_limit causes a crash. For example a sapling growing at the world edge which adds leaves beyond the edge, or placing a structure using the lua voxelmanip, or placing a schematic or l-system tree. Do not run the 'load_if_inexistent' block of code if the mapblock is over limit, this also marks the mapblock with the flag VMANIP_BLOCK_DATA_INEXIST which later prevents blitting back those mapblocks. This fix therefore uses existing functionality by having the same effect as the 'load_if_inexistent' bool being false.
2017-02-13Lighting: Update lighting at block loadingDániel Juhász
This commit updates mapblocks' light if necessary when they are loaded. This removes ghost lighting.
2017-01-20Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072)red-001
2017-01-08Map generation limit: Cache as 'const' not 'const static'paramat
2017-01-08Map generation limit: Fix checks for block/sector over-limitparamat
Fix the maths that check if any part of a mapblock or sector is over the set map_generation_limit. Therefore avoid the loading of any over-limit blocks that were previously generated when map_generation_limit was larger. The set limit can vary for a world because it is not yet a per-world mapgen parameter, even when it is sometimes it will be changed deliberately. Therefore avoid a player being returned to world centre if they re-enter a world while being over-limit. Fix the createSector() crash caused by a mob spawning over-limit in an over-limit mapblock
2017-01-04Improve getPointedThing() (#4346)Dániel Juhász
* Improved getPointedThing() The new algorithm checks every node exactly once. Now the point and normal vector of the collision is also returned in the PointedThing (currently they are not used outside of the function). Now the CNodeDefManager keeps the union of all possible nodeboxes, so the raycast won't miss any nodes. Also if there are only small nodeboxes, getPointedThing() is exceptionally fast. Also adds unit test for VoxelLineIterator. * Cleanup, code move This commit moves getPointedThing() and Client::getSelectedActiveObject() to ClientEnvironment. The map nodes now can decide which neighbors they are connecting to (MapNode::getNeighbors()).
2016-12-24Move PP() and PP2() macros to basic_macros.hRogier
Instead of redefining them everywhere.
2016-12-07Liquids: Update flow on block loadMillersMan
When loading a block add liquid-nodes that might flow away or spread to neighbours to the transforming_liquid queue.
2016-12-07Liquids: Preserve flow state if 'ignore' is a neighbourMillersMan
Prevent waterfalls from falling down or streams from flowing away when the source node is in an unloaded block - Nodes near a CONTENT_IGNORE node will be interpreted as if the ignored node is a liquid node that just supports the current state of the nodes in question.
2016-12-07Map::isValidPosition: Return false instead of throwing exceptionMillersMan
2016-10-27CleanupDániel Juhász
2016-10-27Use node lighting for liquid spreadingDániel Juhász
This commit modifies the liquid transforming procedure to light and unlight nodes instead of whole map blocks.
2016-10-27Improved lightingDániel Juhász
This commit rewrites the procedure that is responsible for light updating. this commit -provides iterative solutions for unlighting and light spreading -introduces a new priority queue-like container for the iteration -creates per-node MapBlock caching to reduce retrieving MapBlocks from the map -calculates with map block positions and in-block relative node coordinates -skips light updating if it is not necessary since the node's new light will be the same as its old light was
2016-07-03Add MapSettingsManager and new mapgen setting script API functionskwolekr
This commit refactors the majority of the Mapgen settings system. - MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap, instead of the EmergeManager. - New Script API functions added: core.get_mapgen_setting core.get_mapgen_setting_noiseparams, core.set_mapgen_setting, and core.set_mapgen_setting_noiseparams. - minetest.get/set_mapgen_params are deprecated by the above new functions. - It is now possible to view and modify any arbitrary mapgen setting from a mod, rather than the base MapgenParams structure. - MapgenSpecificParams has been removed.
2016-06-11Make node timers more efficientEkdohibs
2016-05-22Implement a PostgreSQL backendLoic Blot
2016-05-17DB::loadBlock copy removal & DB backend cleanupLoic Blot
* Remove the copy from db::loadBlock by using a pointer to the destination * cleanup db backend, the child backend doesn't have to set their functions as virtual
2016-03-30Remove expensive copy of ContentFeaturesgregorycu
2016-01-20Liquid flow: Prevent water spreading on ignoreparamat
2016-01-07Liquids: Flow into and destroy 'floodable' nodesparamat
Add new node property 'floodable', default false Define "air" as floodable = true in C++ and lua
2015-10-14Rename macros with two leading underscoresShadowNinja
These names are reserved for the compiler/library implementations.
2015-10-14Use warningstream for log messages with WARNINGShadowNinja
Remove DTIME macro and its uses, too
2015-10-04Add emerge completion callback mechanismkwolekr
Major refactor of emerge.cpp and Map::init/finishBlockMake
2015-10-04Define and use limit constants for Irrlicht fixed-width typeskwolekr
2015-09-23Add /emergeblocks command and core.emerge_area() Lua APIkwolekr
2015-08-13Fix segfault caused by a8e238ed06ee8285ed4459e9deda3117419837f6Perttu Ahola
2015-08-13Add count based unload limit for mapblocksest31
2015-08-02Add map limit config optionrubenwardy
2015-05-17Record MapBlock modification reasons as flags instead of stringskwolekr
This improves performance of MapBlock::raiseModified by a factor of 6. Also, clean up mapblock.h a bit and inline small functions.