Fix delete() in CBot not destroying PowerCells properly
parent
aa1a946336
commit
2d7911f155
|
@ -2157,6 +2157,9 @@ bool CPyro::BurnIsKeepPart(int part)
|
|||
|
||||
void CPyro::BurnTerminate()
|
||||
{
|
||||
if (m_object == nullptr)
|
||||
return;
|
||||
|
||||
if (m_type == PT_BURNO) // organic object is burning?
|
||||
{
|
||||
DeleteObject(true, true); // removes the insect
|
||||
|
|
|
@ -682,6 +682,16 @@ bool CScriptFunctions::rDelete(CBotVar* var, CBotVar* result, int& exception, vo
|
|||
}
|
||||
else
|
||||
{
|
||||
if (obj->Implements(ObjectInterfaceType::Old))
|
||||
{
|
||||
COldObject* oldobj = dynamic_cast<COldObject*>(obj);
|
||||
if (oldobj->GetPower() != nullptr)
|
||||
CObjectManager::GetInstancePointer()->DeleteObject(oldobj->GetPower());
|
||||
if (oldobj->GetCargo() != nullptr)
|
||||
CObjectManager::GetInstancePointer()->DeleteObject(oldobj->GetCargo());
|
||||
oldobj->SetPower(nullptr);
|
||||
oldobj->SetCargo(nullptr);
|
||||
}
|
||||
CObjectManager::GetInstancePointer()->DeleteObject(obj);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue