mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Safely handle block deletion (#13315)
Co-authored-by: Jude Melton-Houghton <jwmhjwmh@gmail.com>
This commit is contained in:
parent
f3b198e490
commit
ed632f3854
7 changed files with 74 additions and 5 deletions
|
@ -81,11 +81,24 @@ public:
|
|||
return NODECONTAINER_ID_MAPBLOCK;
|
||||
}*/
|
||||
|
||||
Map * getParent()
|
||||
Map *getParent()
|
||||
{
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
// Any server-modding code can "delete" arbitrary blocks (i.e. with
|
||||
// core.delete_area), which makes them orphan. Avoid using orphan blocks for
|
||||
// anything.
|
||||
bool isOrphan() const
|
||||
{
|
||||
return !m_parent;
|
||||
}
|
||||
|
||||
void makeOrphan()
|
||||
{
|
||||
m_parent = nullptr;
|
||||
}
|
||||
|
||||
void reallocate()
|
||||
{
|
||||
for (u32 i = 0; i < nodecount; i++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue