mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +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
17
src/map.cpp
17
src/map.cpp
|
@ -30,12 +30,23 @@ Map::Map(IGameDef *gamedef):
|
|||
|
||||
Map::~Map()
|
||||
{
|
||||
/*
|
||||
Free all MapSectors
|
||||
*/
|
||||
// Free all sectors
|
||||
size_t used = 0;
|
||||
for (auto §or : m_sectors) {
|
||||
sector.second->deleteBlocks(&used);
|
||||
delete sector.second;
|
||||
}
|
||||
m_sectors.clear();
|
||||
|
||||
if (used > 0) {
|
||||
#ifdef NDEBUG
|
||||
std::ostream &to = infostream;
|
||||
#else
|
||||
std::ostream &to = warningstream;
|
||||
#endif
|
||||
PrintInfo(to);
|
||||
to << used << " blocks deleted despite reference count > 0. Potential bug." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Map::addEventReceiver(MapEventReceiver *event_receiver)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue