mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Schematics: Remove referenced schematics from Decorations on clear
This commit is contained in:
parent
f0a1379e5a
commit
406d9ba87b
6 changed files with 67 additions and 38 deletions
|
@ -61,16 +61,6 @@ size_t DecorationManager::placeAllDecos(Mapgen *mg, u32 blockseed,
|
|||
}
|
||||
|
||||
|
||||
void DecorationManager::clear()
|
||||
{
|
||||
for (size_t i = 0; i < m_objects.size(); i++) {
|
||||
Decoration *deco = (Decoration *)m_objects[i];
|
||||
delete deco;
|
||||
}
|
||||
m_objects.clear();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
@ -320,8 +310,20 @@ int DecoSimple::getHeight()
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
DecoSchematic::DecoSchematic() :
|
||||
Decoration::Decoration()
|
||||
{
|
||||
schematic = NULL;
|
||||
}
|
||||
|
||||
|
||||
size_t DecoSchematic::generate(MMVManip *vm, PseudoRandom *pr, v3s16 p)
|
||||
{
|
||||
// Schematic could have been unloaded but not the decoration
|
||||
// In this case generate() does nothing (but doesn't *fail*)
|
||||
if (schematic == NULL)
|
||||
return 0;
|
||||
|
||||
if (flags & DECO_PLACE_CENTER_X)
|
||||
p.X -= (schematic->size.X + 1) / 2;
|
||||
if (flags & DECO_PLACE_CENTER_Y)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue