mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31:04 +00:00
Add a bit of debug code around MapBlock refcounting
This commit is contained in:
parent
39417cf7a7
commit
0c12c1f400
6 changed files with 74 additions and 31 deletions
|
@ -19,12 +19,18 @@ MapSector::~MapSector()
|
|||
deleteBlocks();
|
||||
}
|
||||
|
||||
void MapSector::deleteBlocks()
|
||||
void MapSector::deleteBlocks(size_t *used_count)
|
||||
{
|
||||
// Clear cache
|
||||
m_block_cache = nullptr;
|
||||
|
||||
// Delete all blocks
|
||||
size_t u = 0;
|
||||
for (auto &it : m_blocks) {
|
||||
if (it.second->refGet() > 0)
|
||||
u++;
|
||||
it.second.reset();
|
||||
}
|
||||
if (used_count)
|
||||
*used_count += u;
|
||||
m_blocks.clear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue