Fixed a bug in CTaskShield

master
krzys-h 2015-08-14 19:08:26 +02:00
parent 9ad513550b
commit f9abeb21ec
2 changed files with 3 additions and 2 deletions

View File

@ -442,7 +442,7 @@ void COldObject::DestroyObject(DestructionType type)
SetShield(0.0f); SetShield(0.0f);
} }
Gfx::PyroType pyroType; Gfx::PyroType pyroType = Gfx::PT_NULL;
if ( type == DestructionType::Explosion ) // explosion? if ( type == DestructionType::Explosion ) // explosion?
{ {
if ( m_type == OBJECT_ANT || if ( m_type == OBJECT_ANT ||
@ -525,6 +525,7 @@ void COldObject::DestroyObject(DestructionType type)
{ {
pyroType = Gfx::PT_DEADW; pyroType = Gfx::PT_DEADW;
} }
assert(pyroType != Gfx::PT_NULL);
m_engine->GetPyroManager()->Create(pyroType, this); m_engine->GetPyroManager()->Create(pyroType, this);
if ( Implements(ObjectInterfaceType::Programmable) ) if ( Implements(ObjectInterfaceType::Programmable) )

View File

@ -544,7 +544,7 @@ void CTaskShield::IncreaseShield()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if (!obj->Implements(ObjectInterfaceType::Shielded)); if (!obj->Implements(ObjectInterfaceType::Shielded));
CShieldedObject* shielded = dynamic_cast<CShieldedObject*>(shielded); CShieldedObject* shielded = dynamic_cast<CShieldedObject*>(obj);
if (!shielded->IsRepairable()) continue; // NOTE: Looks like the original code forgot to check that if (!shielded->IsRepairable()) continue; // NOTE: Looks like the original code forgot to check that
Math::Vector oPos = obj->GetPosition(); Math::Vector oPos = obj->GetPosition();