mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Detect air-only blocks instead of day/night differences (#14264)
* Detect air-only blocks instead day/night differences * Write !is_air into the former day-night-diff bit on disk, so that old server can still read maps written by new servers * Only set is_air bit when reading from disk
This commit is contained in:
parent
0d30a3071a
commit
0d4b489545
5 changed files with 52 additions and 75 deletions
15
src/map.cpp
15
src/map.cpp
|
@ -228,12 +228,12 @@ void Map::addNodeAndUpdate(v3s16 p, MapNode n,
|
|||
std::vector<std::pair<v3s16, MapNode> > oldnodes;
|
||||
oldnodes.emplace_back(p, oldnode);
|
||||
voxalgo::update_lighting_nodes(this, oldnodes, modified_blocks);
|
||||
|
||||
for (auto &modified_block : modified_blocks) {
|
||||
modified_block.second->expireDayNightDiff();
|
||||
}
|
||||
}
|
||||
|
||||
if (n.getContent() != oldnode.getContent() &&
|
||||
(oldnode.getContent() == CONTENT_AIR || n.getContent() == CONTENT_AIR))
|
||||
block->expireIsAirCache();
|
||||
|
||||
// Report for rollback
|
||||
if(m_gamedef->rollback())
|
||||
{
|
||||
|
@ -1462,14 +1462,14 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
|
|||
if (!block)
|
||||
continue;
|
||||
/*
|
||||
Update day/night difference cache of the MapBlocks
|
||||
Update is air cache of the MapBlocks
|
||||
*/
|
||||
block->expireDayNightDiff();
|
||||
block->expireIsAirCache();
|
||||
/*
|
||||
Set block as modified
|
||||
*/
|
||||
block->raiseModified(MOD_STATE_WRITE_NEEDED,
|
||||
MOD_REASON_EXPIRE_DAYNIGHTDIFF);
|
||||
MOD_REASON_EXPIRE_IS_AIR);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2064,6 +2064,7 @@ void MMVManip::blitBackAll(std::map<v3s16, MapBlock*> *modified_blocks,
|
|||
|
||||
block->copyFrom(*this);
|
||||
block->raiseModified(MOD_STATE_WRITE_NEEDED, MOD_REASON_VMANIP);
|
||||
block->expireIsAirCache();
|
||||
|
||||
if(modified_blocks)
|
||||
(*modified_blocks)[p] = block;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue