summaryrefslogtreecommitdiff
path: root/src/map.cpp
Commit message (Collapse)AuthorAge
* Allow an optional readonly base database (#7544)lhofhansl2018-07-25
| | | | | | * Allow an optional readonly base database * Added basic documentation
* Add a MSVC / Windows compatible snprintf function (#7353)nOOb31672018-07-22
| | | Use sizeof where applicable for mt_snprintf
* Variable name fix + structure creation unrolling in lighting codeLoic Blot2018-03-09
|
* SAO limits: Allow SAOs to exist outside the set 'mapgen limit'paramat2018-02-26
|
* map.cpp: Initialize NodeNeighbor, set NeighborType to u8 & cleanupLoic Blot2018-02-11
| | | | | | | Cleanup: * Drop unused Map::transforming_liquid_size() * NodeNeighbor must use const ref for v3s16 * Add a missing default in a switch case
* Move files to subdirectories (#6599)Vitaliy2017-11-08
| | | | * Move files around
* Fix blocks written by vmanip not being marked as modifiedsfan52017-09-23
| | | | | This bug can be triggered by e.g. calling minetest.place_schematic() and stopping the server immediately afterwards.
* Remove DSTACK support (#6346)Loïc Blot2017-08-30
| | | Debugstacks is not useful, we don't really use it, the DebugStack is not pertinent, gdb and lldb are better if we really want to debug.
* Modernize code: very last fixes (#6290)Loïc Blot2017-08-20
| | | Last modernization fixes
* ServerMap saving: cleanups (#6274)Loïc Blot2017-08-19
| | | | * 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
* Code modernization: src/m* (part 3)Loic Blot2017-08-19
| | | | | | | | * empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * remove some unused headers in some cpp variable
* Code modernization: src/m* (part 2)Loic Blot2017-08-19
| | | | | | | | | * 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
* Modernize various files (src/m*) (#6267)Loïc Blot2017-08-18
| | | | | | | | | | | | * 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
* Remove unused Map::getDayNightDiff + fix one undefined variable in mapblock.cppLoic Blot2017-07-26
|
* Cpp11 initializers 2 (#5999)Loïc Blot2017-06-17
| | | | | | | | | | * 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
* Properly remove SAO when worldedges are overtaken (#5889)Loïc Blot2017-06-03
| | | | | | | | | | | | * 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
* Time: Change old `u32` timestamps to 64-bit (#5818)SmallJoker2017-05-26
| | | | MacOSX build fix + cleanups
* Clean up getTime helpersShadowNinja2017-04-28
| | | | | | 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.
* Rename Scripting API files for consistencyShadowNinja2017-04-25
|
* Player data to Database (#5475)Loïc Blot2017-04-23
| | | | | | | | | | | | * 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
* Add on_flood() callback.Auke Kok2017-04-22
| | | | | | | | | | | | | | | | | | | | | 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.
* Light update for map blocksDániel Juhász2017-04-20
| | | | | | | | | 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.
* Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)Loïc Blot2017-04-20
| | | | * Also remove 2 non declared but defined functions * Make some functions around const ref changes const
* Fix various variables passed by copy instead of const ref (#5610)Loïc Blot2017-04-19
| | | Pointed by cppcheck
* Map generation limit: Make per-worldparamat2017-03-27
| | | | | | | | | | | 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.
* Map generation limit: Rewriteparamat2017-03-20
| | | | | | | | | | | | | | 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.
* Update server min protocol version to v24 (#5411)Loïc Blot2017-03-19
| | | | | | | | | | * 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
* Allow server side occlusion culling.Lars Hofhansl2017-03-11
|
* Light calculation: New bulk node lighting codeDániel Juhász2017-03-11
| | | | | | | | | | | 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.
* Voxelmanip: Do not emerge or blit to blocks over map gen limitparamat2017-02-18
| | | | | | | | | | | | | | | 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.
* Lighting: Update lighting at block loadingDániel Juhász2017-02-13
| | | | | This commit updates mapblocks' light if necessary when they are loaded. This removes ghost lighting.
* Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072)red-0012017-01-20
|
* Map generation limit: Cache as 'const' not 'const static'paramat2017-01-08
|
* Map generation limit: Fix checks for block/sector over-limitparamat2017-01-08
| | | | | | | | | | | | | | 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
* Improve getPointedThing() (#4346)Dániel Juhász2017-01-04
| | | | | | | | | | | | | | | | | | | * 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()).
* Move PP() and PP2() macros to basic_macros.hRogier2016-12-24
| | | | Instead of redefining them everywhere.
* Liquids: Update flow on block loadMillersMan2016-12-07
| | | | | When loading a block add liquid-nodes that might flow away or spread to neighbours to the transforming_liquid queue.
* Liquids: Preserve flow state if 'ignore' is a neighbourMillersMan2016-12-07
| | | | | | | 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.
* Map::isValidPosition: Return false instead of throwing exceptionMillersMan2016-12-07
|
* CleanupDániel Juhász2016-10-27
|
* Use node lighting for liquid spreadingDániel Juhász2016-10-27
| | | | This commit modifies the liquid transforming procedure to light and unlight nodes instead of whole map blocks.
* Improved lightingDániel Juhász2016-10-27
| | | | | | | | | | | | | | 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
* Add MapSettingsManager and new mapgen setting script API functionskwolekr2016-07-03
| | | | | | | | | | | | | | | 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.
* Make node timers more efficientEkdohibs2016-06-11
|
* Implement a PostgreSQL backendLoic Blot2016-05-22
|
* DB::loadBlock copy removal & DB backend cleanupLoic Blot2016-05-17
| | | | | * 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
* Remove expensive copy of ContentFeaturesgregorycu2016-03-30
|
* Liquid flow: Prevent water spreading on ignoreparamat2016-01-20
|
* Liquids: Flow into and destroy 'floodable' nodesparamat2016-01-07
| | | | | Add new node property 'floodable', default false Define "air" as floodable = true in C++ and lua
* Rename macros with two leading underscoresShadowNinja2015-10-14
| | | | These names are reserved for the compiler/library implementations.