1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-05 18:41:05 +00:00

Use unique_ptrs for MapSector::m_blocks

This commit is contained in:
Desour 2023-03-03 15:20:29 +01:00 committed by DS
parent 08ea467bfe
commit 1780d1bbde
4 changed files with 49 additions and 49 deletions

View file

@ -50,16 +50,17 @@ public:
return m_pos;
}
MapBlock * getBlockNoCreateNoEx(s16 y);
MapBlock * createBlankBlockNoInsert(s16 y);
MapBlock * createBlankBlock(s16 y);
MapBlock *getBlockNoCreateNoEx(s16 y);
std::unique_ptr<MapBlock> createBlankBlockNoInsert(s16 y);
MapBlock *createBlankBlock(s16 y);
void insertBlock(MapBlock *block);
void insertBlock(std::unique_ptr<MapBlock> block);
void deleteBlock(MapBlock *block);
// Remove a block from the map and the sector without deleting it
void detachBlock(MapBlock *block);
// Returns an owning ptr to block.
std::unique_ptr<MapBlock> detachBlock(MapBlock *block);
void getBlocks(MapBlockVect &dest);
@ -69,7 +70,7 @@ public:
protected:
// The pile of MapBlocks
std::unordered_map<s16, MapBlock*> m_blocks;
std::unordered_map<s16, std::unique_ptr<MapBlock>> m_blocks;
Map *m_parent;
// Position on parent (in MapBlock widths)