summaryrefslogtreecommitdiff
path: root/src/voxelalgorithms.cpp
diff options
context:
space:
mode:
authorDániel Juhász <juhdanad@gmail.com>2018-02-10 22:04:16 +0200
committerSmallJoker <SmallJoker@users.noreply.github.com>2018-02-10 21:04:16 +0100
commit3face01a202040e4feff3b0936b4aa89c051c98d (patch)
treeccdad6773aa9705cc07fdc9f71f28bae395f353e /src/voxelalgorithms.cpp
parent617d94c8038e3ff035eaeef7ccdfa4f442feb873 (diff)
downloadminetest-3face01a202040e4feff3b0936b4aa89c051c98d.tar.gz
minetest-3face01a202040e4feff3b0936b4aa89c051c98d.tar.bz2
minetest-3face01a202040e4feff3b0936b4aa89c051c98d.zip
Node definition manager refactor (#7016)
* Rename IWritableNodeDefManager to NodeDefManager * Make INodeDefManager functions const * Use "const *NodeDefManager" instead of "*INodeDefManager" * Remove unused INodeDefManager class * Merge NodeDefManager and CNodeDefManager * Document NodeDefManager
Diffstat (limited to 'src/voxelalgorithms.cpp')
-rw-r--r--src/voxelalgorithms.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/voxelalgorithms.cpp b/src/voxelalgorithms.cpp
index bcf2b9a38..947bea32e 100644
--- a/src/voxelalgorithms.cpp
+++ b/src/voxelalgorithms.cpp
@@ -246,7 +246,7 @@ bool step_rel_block_pos(direction dir, relative_v3 &rel_pos,
* \param light_sources nodes that should be re-lighted
* \param modified_blocks output, all modified map blocks are added to this
*/
-void unspread_light(Map *map, INodeDefManager *nodemgr, LightBank bank,
+void unspread_light(Map *map, const NodeDefManager *nodemgr, LightBank bank,
UnlightQueue &from_nodes, ReLightQueue &light_sources,
std::map<v3s16, MapBlock*> &modified_blocks)
{
@@ -350,7 +350,7 @@ void unspread_light(Map *map, INodeDefManager *nodemgr, LightBank bank,
* \param light_sources starting nodes
* \param modified_blocks output, all modified map blocks are added to this
*/
-void spread_light(Map *map, INodeDefManager *nodemgr, LightBank bank,
+void spread_light(Map *map, const NodeDefManager *nodemgr, LightBank bank,
LightQueue &light_sources,
std::map<v3s16, MapBlock*> &modified_blocks)
{
@@ -427,7 +427,7 @@ struct SunlightPropagationData{
*
* \param pos position of the node.
*/
-bool is_sunlight_above(Map *map, v3s16 pos, INodeDefManager *ndef)
+bool is_sunlight_above(Map *map, v3s16 pos, const NodeDefManager *ndef)
{
bool sunlight = true;
mapblock_v3 source_block_pos;
@@ -470,7 +470,7 @@ void update_lighting_nodes(Map *map,
std::vector<std::pair<v3s16, MapNode> > &oldnodes,
std::map<v3s16, MapBlock*> &modified_blocks)
{
- INodeDefManager *ndef = map->getNodeDefManager();
+ const NodeDefManager *ndef = map->getNodeDefManager();
// For node getter functions
bool is_valid_position;
@@ -664,8 +664,8 @@ const VoxelArea block_borders[] = {
* its light source and its brightest neighbor minus one.
* .
*/
-bool is_light_locally_correct(Map *map, INodeDefManager *ndef, LightBank bank,
- v3s16 pos)
+bool is_light_locally_correct(Map *map, const NodeDefManager *ndef,
+ LightBank bank, v3s16 pos)
{
bool is_valid_position;
MapNode n = map->getNodeNoEx(pos, &is_valid_position);
@@ -691,7 +691,7 @@ bool is_light_locally_correct(Map *map, INodeDefManager *ndef, LightBank bank,
void update_block_border_lighting(Map *map, MapBlock *block,
std::map<v3s16, MapBlock*> &modified_blocks)
{
- INodeDefManager *ndef = map->getNodeDefManager();
+ const NodeDefManager *ndef = map->getNodeDefManager();
bool is_valid_position;
for (LightBank bank : banks) {
// Since invalid light is not common, do not allocate
@@ -777,7 +777,7 @@ void update_block_border_lighting(Map *map, MapBlock *block,
* After the procedure returns, this contains outgoing light at
* the bottom of the voxel manipulator.
*/
-void fill_with_sunlight(MMVManip *vm, INodeDefManager *ndef, v2s16 offset,
+void fill_with_sunlight(MMVManip *vm, const NodeDefManager *ndef, v2s16 offset,
bool light[MAP_BLOCKSIZE][MAP_BLOCKSIZE])
{
// Distance in array between two nodes on top of each other.
@@ -829,7 +829,7 @@ void fill_with_sunlight(MMVManip *vm, INodeDefManager *ndef, v2s16 offset,
* node coordinates.
*/
void is_sunlight_above_block(ServerMap *map, mapblock_v3 pos,
- INodeDefManager *ndef, bool light[MAP_BLOCKSIZE][MAP_BLOCKSIZE])
+ const NodeDefManager *ndef, bool light[MAP_BLOCKSIZE][MAP_BLOCKSIZE])
{
mapblock_v3 source_block_pos = pos + v3s16(0, 1, 0);
// Get or load source block.
@@ -874,7 +874,7 @@ void is_sunlight_above_block(ServerMap *map, mapblock_v3 pos,
*
* \returns true if the block was modified, false otherwise.
*/
-bool propagate_block_sunlight(Map *map, INodeDefManager *ndef,
+bool propagate_block_sunlight(Map *map, const NodeDefManager *ndef,
SunlightPropagationData *data, UnlightQueue *unlight, ReLightQueue *relight)
{
bool modified = false;
@@ -980,7 +980,7 @@ void finish_bulk_light_update(Map *map, mapblock_v3 minblock,
mapblock_v3 maxblock, UnlightQueue unlight[2], ReLightQueue relight[2],
std::map<v3s16, MapBlock*> *modified_blocks)
{
- INodeDefManager *ndef = map->getNodeDefManager();
+ const NodeDefManager *ndef = map->getNodeDefManager();
// dummy boolean
bool is_valid;
@@ -1048,7 +1048,7 @@ void finish_bulk_light_update(Map *map, mapblock_v3 minblock,
void blit_back_with_light(ServerMap *map, MMVManip *vm,
std::map<v3s16, MapBlock*> *modified_blocks)
{
- INodeDefManager *ndef = map->getNodeDefManager();
+ const NodeDefManager *ndef = map->getNodeDefManager();
mapblock_v3 minblock = getNodeBlockPos(vm->m_area.MinEdge);
mapblock_v3 maxblock = getNodeBlockPos(vm->m_area.MaxEdge);
// First queue is for day light, second is for night light.
@@ -1152,7 +1152,7 @@ void blit_back_with_light(ServerMap *map, MMVManip *vm,
* After the procedure returns, this contains outgoing light at
* the bottom of the map block.
*/
-void fill_with_sunlight(MapBlock *block, INodeDefManager *ndef,
+void fill_with_sunlight(MapBlock *block, const NodeDefManager *ndef,
bool light[MAP_BLOCKSIZE][MAP_BLOCKSIZE])
{
if (block->isDummy())
@@ -1190,7 +1190,7 @@ void repair_block_light(ServerMap *map, MapBlock *block,
{
if (!block || block->isDummy())
return;
- INodeDefManager *ndef = map->getNodeDefManager();
+ const NodeDefManager *ndef = map->getNodeDefManager();
// First queue is for day light, second is for night light.
UnlightQueue unlight[] = { UnlightQueue(256), UnlightQueue(256) };
ReLightQueue relight[] = { ReLightQueue(256), ReLightQueue(256) };