diff --git a/colobot-gcc11.patch b/colobot-gcc11.patch index 24c44c6..fa2b7d9 100644 --- a/colobot-gcc11.patch +++ b/colobot-gcc11.patch @@ -96,3 +96,2035 @@ index 2d0f90f..1ad95d0 100644 - dynamic_cast(obj)->IsBeingTransported(); + dynamic_cast(*obj).IsBeingTransported(); } +diff --git a/src/graphics/engine/lightning.cpp b/src/graphics/engine/lightning.cpp +index 9c1a64b..eab99a4 100644 +--- a/src/graphics/engine/lightning.cpp ++++ b/src/graphics/engine/lightning.cpp +@@ -323,7 +323,7 @@ CObject* CLightning::SearchObject(Math::Vector pos) + + if (!obj->Implements(ObjectInterfaceType::Destroyable)) continue; + +- float detect = m_magnetic * dynamic_cast(obj)->GetLightningHitProbability(); ++ float detect = m_magnetic * dynamic_cast(*obj).GetLightningHitProbability(); + if (detect == 0.0f) continue; + + Math::Vector oPos = obj->GetPosition(); +diff --git a/src/graphics/engine/particle.cpp b/src/graphics/engine/particle.cpp +index 5c6d169..0a7fa9b 100644 +--- a/src/graphics/engine/particle.cpp ++++ b/src/graphics/engine/particle.cpp +@@ -954,7 +954,7 @@ void CParticle::FrameParticle(float rTime) + m_particle[i].goal = m_particle[i].pos; + if (object != nullptr && object->Implements(ObjectInterfaceType::Damageable)) + { +- dynamic_cast(object)->DamageObject(DamageType::Phazer, 0.002f, m_particle[i].objFather); ++ dynamic_cast(*object).DamageObject(DamageType::Phazer, 0.002f, m_particle[i].objFather); + } + + m_particle[i].zoom = 1.0f-(m_particle[i].time-m_particle[i].duration); +@@ -1157,7 +1157,7 @@ void CParticle::FrameParticle(float rTime) + { + if (object->Implements(ObjectInterfaceType::Damageable)) + { +- dynamic_cast(object)->DamageObject(DamageType::Fire, 0.001f, m_particle[i].objFather); ++ dynamic_cast(*object).DamageObject(DamageType::Fire, 0.001f, m_particle[i].objFather); + } + + m_exploGunCounter++; +@@ -1223,7 +1223,7 @@ void CParticle::FrameParticle(float rTime) + m_particle[i].goal = m_particle[i].pos; + if (object != nullptr) + { +- if (object->GetType() == OBJECT_MOBILErs && dynamic_cast(object)->GetActiveShieldRadius() > 0.0f) // protected by shield? ++ if (object->GetType() == OBJECT_MOBILErs && dynamic_cast(*object).GetActiveShieldRadius() > 0.0f) // protected by shield? + { + CreateParticle(m_particle[i].pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(6.0f, 6.0f), PARTIGUNDEL, 2.0f); + if (m_lastTimeGunDel > 0.2f) +@@ -1241,7 +1241,7 @@ void CParticle::FrameParticle(float rTime) + + if (object->Implements(ObjectInterfaceType::Damageable)) + { +- dynamic_cast(object)->DamageObject(DamageType::Organic, 0.1f, m_particle[i].objFather); // starts explosion ++ dynamic_cast(*object).DamageObject(DamageType::Organic, 0.1f, m_particle[i].objFather); // starts explosion + } + } + } +@@ -1271,7 +1271,7 @@ void CParticle::FrameParticle(float rTime) + m_particle[i].goal = m_particle[i].pos; + if (object != nullptr) + { +- if (object->GetType() == OBJECT_MOBILErs && dynamic_cast(object)->GetActiveShieldRadius() > 0.0f) ++ if (object->GetType() == OBJECT_MOBILErs && dynamic_cast(*object).GetActiveShieldRadius() > 0.0f) + { + CreateParticle(m_particle[i].pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(6.0f, 6.0f), PARTIGUNDEL, 2.0f); + if (m_lastTimeGunDel > 0.2f) +@@ -1286,7 +1286,7 @@ void CParticle::FrameParticle(float rTime) + { + if (object->Implements(ObjectInterfaceType::Damageable)) + { +- dynamic_cast(object)->DamageObject(DamageType::Fire, std::numeric_limits::infinity(), m_particle[i].objFather); // starts explosion ++ dynamic_cast(*object).DamageObject(DamageType::Fire, std::numeric_limits::infinity(), m_particle[i].objFather); // starts explosion + } + } + } +@@ -1345,7 +1345,7 @@ void CParticle::FrameParticle(float rTime) + { + if (object->Implements(ObjectInterfaceType::Damageable)) + { +- dynamic_cast(object)->DamageObject(DamageType::Organic, 0.001f, m_particle[i].objFather); ++ dynamic_cast(*object).DamageObject(DamageType::Organic, 0.001f, m_particle[i].objFather); + } + + m_exploGunCounter ++; +@@ -2423,7 +2423,7 @@ void CParticle::FrameParticle(float rTime) + if (object != nullptr) + { + assert(object->Implements(ObjectInterfaceType::Damageable)); +- dynamic_cast(object)->DamageObject(DamageType::Tower, std::numeric_limits::infinity(), m_particle[i].objFather); ++ dynamic_cast(*object).DamageObject(DamageType::Tower, std::numeric_limits::infinity(), m_particle[i].objFather); + } + } + +diff --git a/src/graphics/engine/pyro.cpp b/src/graphics/engine/pyro.cpp +index 6eedf85..2fab0b1 100644 +--- a/src/graphics/engine/pyro.cpp ++++ b/src/graphics/engine/pyro.cpp +@@ -129,7 +129,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force) + + CObject* power = nullptr; + if (obj->Implements(ObjectInterfaceType::Powered)) +- power = dynamic_cast(obj)->GetPower(); ++ power = dynamic_cast(*obj).GetPower(); + + if (power == nullptr) + { +@@ -256,7 +256,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force) + m_sound->Play(SOUND_DEADw, m_pos); + } + assert(m_object->Implements(ObjectInterfaceType::Controllable)); +- if ( type == PT_SHOTH && dynamic_cast(m_object)->GetSelect() ) ++ if ( type == PT_SHOTH && dynamic_cast(*m_object).GetSelect() ) + { + m_sound->Play(SOUND_AIE, m_pos); + m_sound->Play(SOUND_AIE, m_engine->GetEyePt()); +@@ -273,10 +273,10 @@ bool CPyro::Create(PyroType type, CObject* obj, float force) + if ( m_type == PT_DEADG ) + { + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); +- dynamic_cast(m_object)->SetDying(DeathType::Dead); ++ dynamic_cast(*m_object).SetDying(DeathType::Dead); + + assert(obj->Implements(ObjectInterfaceType::Movable)); +- dynamic_cast(obj)->GetMotion()->SetAction(MHS_DEADg, 1.0f); ++ dynamic_cast(*obj).GetMotion()->SetAction(MHS_DEADg, 1.0f); + + m_camera->StartCentering(m_object, Math::PI*0.5f, 99.9f, 0.0f, 1.5f); + m_camera->StartOver(CAM_OVER_EFFECT_FADEOUT_WHITE, m_pos, 1.0f); +@@ -286,10 +286,10 @@ bool CPyro::Create(PyroType type, CObject* obj, float force) + if ( m_type == PT_DEADW ) + { + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); +- dynamic_cast(m_object)->SetDying(DeathType::Dead); ++ dynamic_cast(*m_object).SetDying(DeathType::Dead); + + assert(obj->Implements(ObjectInterfaceType::Movable)); +- dynamic_cast(obj)->GetMotion()->SetAction(MHS_DEADw, 1.0f); ++ dynamic_cast(*obj).GetMotion()->SetAction(MHS_DEADw, 1.0f); + + m_camera->StartCentering(m_object, Math::PI*0.5f, 99.9f, 0.0f, 3.0f); + m_camera->StartOver(CAM_OVER_EFFECT_FADEOUT_BLACK, m_pos, 1.0f); +@@ -307,7 +307,7 @@ bool CPyro::Create(PyroType type, CObject* obj, float force) + if ( m_type == PT_SHOTH ) + { + assert(m_object->Implements(ObjectInterfaceType::Controllable)); +- if ( m_camera->GetBlood() && dynamic_cast(m_object)->GetSelect() ) ++ if ( m_camera->GetBlood() && dynamic_cast(*m_object).GetSelect() ) + { + m_camera->StartOver(CAM_OVER_EFFECT_BLOOD, m_pos, force); + } +@@ -1381,7 +1381,7 @@ void CPyro::DeleteObject(bool primary, bool secondary) + if (m_object->Implements(ObjectInterfaceType::Transportable)) + { + // TODO: this should be handled in the object's destructor +- CObject* transporter = dynamic_cast(m_object)->GetTransporter(); ++ CObject* transporter = dynamic_cast(*m_object).GetTransporter(); + if (transporter != nullptr) + { + if (transporter->Implements(ObjectInterfaceType::Powered)) +@@ -1546,12 +1546,12 @@ void CPyro::ExploStart() + m_object->Simplify(); + m_object->SetLock(true); // ruin not usable yet + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); +- dynamic_cast(m_object)->SetDying(DeathType::Exploding); // being destroyed ++ dynamic_cast(*m_object).SetDying(DeathType::Exploding); // being destroyed + m_object->FlatParent(); + +- if ( m_object->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(m_object)->GetSelect() ) ++ if ( m_object->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(*m_object).GetSelect() ) + { +- dynamic_cast(m_object)->SetSelect(false); // deselects the object ++ dynamic_cast(*m_object).SetSelect(false); // deselects the object + m_camera->SetType(CAM_TYPE_EXPLO); + m_main->DeselectAll(); + } +@@ -1575,7 +1575,7 @@ void CPyro::ExploStart() + + // TODO: temporary hack (hopefully) + assert(m_object->Implements(ObjectInterfaceType::Old)); +- Math::Vector pos = dynamic_cast(m_object)->GetPartPosition(i); ++ Math::Vector pos = dynamic_cast(*m_object).GetPartPosition(i); + + Math::Vector speed; + float weight; +@@ -1622,9 +1622,9 @@ void CPyro::BurnStart() + m_object->Simplify(); + m_object->SetLock(true); // ruin not usable yet + +- if ( m_object->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(m_object)->GetSelect() ) ++ if ( m_object->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(*m_object).GetSelect() ) + { +- dynamic_cast(m_object)->SetSelect(false); // deselects the object ++ dynamic_cast(*m_object).SetSelect(false); // deselects the object + m_camera->SetType(CAM_TYPE_EXPLO); + m_main->DeselectAll(); + } +@@ -2139,7 +2139,7 @@ void CPyro::BurnProgress() + + if (m_object->Implements(ObjectInterfaceType::Powered)) + { +- CObject* sub = dynamic_cast(m_object)->GetPower(); ++ CObject* sub = dynamic_cast(*m_object).GetPower(); + if (sub != nullptr) // is there a battery? + sub->SetScaleY(1.0f - m_progress); // complete flattening + } +@@ -2232,7 +2232,7 @@ CObject* CPyro::FallSearchBeeExplo() + + if (obj->GetType() == OBJECT_MOBILErs) + { +- float shieldRadius = dynamic_cast(obj)->GetActiveShieldRadius(); ++ float shieldRadius = dynamic_cast(*obj).GetActiveShieldRadius(); + if ( shieldRadius > 0.0f ) + { + float distance = Math::Distance(oPos, bulletCrashSphere.sphere.pos); +@@ -2300,12 +2300,12 @@ void CPyro::FallProgress(float rTime) + { + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); + // TODO: implement "killer"? +- dynamic_cast(m_object)->DestroyObject(DestructionType::Explosion); ++ dynamic_cast(*m_object).DestroyObject(DestructionType::Explosion); + } + } + else + { +- if (obj->GetType() == OBJECT_MOBILErs && dynamic_cast(obj)->GetActiveShieldRadius() > 0.0f) // protected by shield? ++ if (obj->GetType() == OBJECT_MOBILErs && dynamic_cast(*obj).GetActiveShieldRadius() > 0.0f) // protected by shield? + { + m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), + Math::Point(6.0f, 6.0f), PARTIGUNDEL, 2.0f, 0.0f, 0.0f); +@@ -2316,7 +2316,7 @@ void CPyro::FallProgress(float rTime) + else + { + assert(obj->Implements(ObjectInterfaceType::Damageable)); +- if (dynamic_cast(obj)->DamageObject(DamageType::FallingObject)) ++ if (dynamic_cast(*obj).DamageObject(DamageType::FallingObject)) + { + DeleteObject(true, true); // removes the ball + } +@@ -2324,7 +2324,7 @@ void CPyro::FallProgress(float rTime) + { + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); + // TODO: implement "killer"? +- dynamic_cast(m_object)->DestroyObject(DestructionType::Explosion); ++ dynamic_cast(*m_object).DestroyObject(DestructionType::Explosion); + } + } + } +diff --git a/src/level/mainmovie.cpp b/src/level/mainmovie.cpp +index 4aa4245..52df226 100644 +--- a/src/level/mainmovie.cpp ++++ b/src/level/mainmovie.cpp +@@ -90,7 +90,7 @@ bool CMainMovie::Start(MainMovieType type, float time) + } + + assert(pObj->Implements(ObjectInterfaceType::Movable)); +- dynamic_cast(pObj)->GetMotion()->SetAction(MHS_SATCOM, 0.5f); // reads the SatCom ++ dynamic_cast(*pObj).GetMotion()->SetAction(MHS_SATCOM, 0.5f); // reads the SatCom + + m_camera->GetCamera(m_initialEye, m_initialLookat); + m_camera->SetType(Gfx::CAM_TYPE_SCRIPT); +@@ -110,7 +110,7 @@ bool CMainMovie::Start(MainMovieType type, float time) + if ( pObj != nullptr ) + { + assert(pObj->Implements(ObjectInterfaceType::Movable)); +- dynamic_cast(pObj)->GetMotion()->SetAction(-1); // finishes reading SatCom ++ dynamic_cast(*pObj).GetMotion()->SetAction(-1); // finishes reading SatCom + } + + m_camera->SetType(Gfx::CAM_TYPE_BACK); +@@ -132,7 +132,7 @@ bool CMainMovie::Stop() + if ( pObj != nullptr ) + { + assert(pObj->Implements(ObjectInterfaceType::Movable)); +- dynamic_cast(pObj)->GetMotion()->SetAction(-1); // finishes reading SatCom ++ dynamic_cast(*pObj).GetMotion()->SetAction(-1); // finishes reading SatCom + } + } + +diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp +index 58d9054..3da33d1 100644 +--- a/src/level/robotmain.cpp ++++ b/src/level/robotmain.cpp +@@ -1330,7 +1330,7 @@ void CRobotMain::ExecuteCmd(const std::string& cmd) + { + CObject* object = GetSelect(); + if (object != nullptr && object->Implements(ObjectInterfaceType::Shielded)) +- dynamic_cast(object)->SetMagnifyDamage(dynamic_cast(object)->GetMagnifyDamage()*0.1f); ++ dynamic_cast(*object).SetMagnifyDamage(dynamic_cast(*object).GetMagnifyDamage()*0.1f); + return; + } + +@@ -1338,7 +1338,7 @@ void CRobotMain::ExecuteCmd(const std::string& cmd) + { + CObject* object = GetSelect(); + if (object != nullptr && object->Implements(ObjectInterfaceType::JetFlying)) +- dynamic_cast(object)->SetRange(dynamic_cast(object)->GetRange()*10.0f); ++ dynamic_cast(*object).SetRange(dynamic_cast(*object).GetRange()*10.0f); + return; + } + +@@ -1363,16 +1363,16 @@ void CRobotMain::ExecuteCmd(const std::string& cmd) + { + if (object->Implements(ObjectInterfaceType::Powered)) + { +- CObject* power = dynamic_cast(object)->GetPower(); ++ CObject* power = dynamic_cast(*object).GetPower(); + if (power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer)) +- dynamic_cast(power)->SetEnergyLevel(1.0f); ++ dynamic_cast(*power).SetEnergyLevel(1.0f); + } + + if (object->Implements(ObjectInterfaceType::Shielded)) +- dynamic_cast(object)->SetShield(1.0f); ++ dynamic_cast(*object).SetShield(1.0f); + + if (object->Implements(ObjectInterfaceType::JetFlying)) +- dynamic_cast(object)->SetReactorRange(1.0f); ++ dynamic_cast(*object).SetReactorRange(1.0f); + } + return; + } +@@ -1385,9 +1385,9 @@ void CRobotMain::ExecuteCmd(const std::string& cmd) + { + if (object->Implements(ObjectInterfaceType::Powered)) + { +- CObject* power = dynamic_cast(object)->GetPower(); ++ CObject* power = dynamic_cast(*object).GetPower(); + if (power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer)) +- dynamic_cast(power)->SetEnergyLevel(1.0f); ++ dynamic_cast(*power).SetEnergyLevel(1.0f); + } + } + return; +@@ -1397,7 +1397,7 @@ void CRobotMain::ExecuteCmd(const std::string& cmd) + { + CObject* object = GetSelect(); + if (object != nullptr && object->Implements(ObjectInterfaceType::Shielded)) +- dynamic_cast(object)->SetShield(1.0f); ++ dynamic_cast(*object).SetShield(1.0f); + return; + } + +@@ -1407,7 +1407,7 @@ void CRobotMain::ExecuteCmd(const std::string& cmd) + if (object != nullptr) + { + if (object->Implements(ObjectInterfaceType::JetFlying)) +- dynamic_cast(object)->SetReactorRange(1.0f); ++ dynamic_cast(*object).SetReactorRange(1.0f); + } + return; + } +@@ -1507,7 +1507,7 @@ void CRobotMain::StartDisplayInfo(int index, bool movie) + if (!m_editLock && movie && !m_movie->IsExist() && human) + { + assert(obj->Implements(ObjectInterfaceType::Movable)); +- if (dynamic_cast(obj)->GetMotion()->GetAction() == -1) ++ if (dynamic_cast(*obj).GetMotion()->GetAction() == -1) + { + m_movieInfoIndex = index; + m_movie->Start(MM_SATCOMopen, 2.5f); +@@ -1821,7 +1821,7 @@ CObject* CRobotMain::DeselectAll() + void CRobotMain::SelectOneObject(CObject* obj, bool displayError) + { + assert(obj->Implements(ObjectInterfaceType::Controllable)); +- dynamic_cast(obj)->SetSelect(true, displayError); ++ dynamic_cast(*obj).SetSelect(true, displayError); + m_camera->SetControllingObject(obj); + + ObjectType type = obj->GetType(); +@@ -1854,7 +1854,7 @@ void CRobotMain::SelectOneObject(CObject* obj, bool displayError) + type == OBJECT_MOBILEdr || + type == OBJECT_APOLLO2 ) + { +- m_camera->SetType(dynamic_cast(obj)->GetCameraType()); ++ m_camera->SetType(dynamic_cast(*obj).GetCameraType()); + } + else + { +@@ -1870,7 +1870,7 @@ bool CRobotMain::SelectObject(CObject* obj, bool displayError) + if (m_movieLock || m_editLock) return false; + if (m_movie->IsExist()) return false; + if (obj != nullptr && +- (!obj->Implements(ObjectInterfaceType::Controllable) || !(dynamic_cast(obj)->GetSelectable() || m_cheatSelectInsect))) return false; ++ (!obj->Implements(ObjectInterfaceType::Controllable) || !(dynamic_cast(*obj).GetSelectable() || m_cheatSelectInsect))) return false; + + if (m_missionType == MISSION_CODE_BATTLE && m_codeBattleStarted && m_codeBattleSpectator) + { +@@ -1946,7 +1946,7 @@ CObject* CRobotMain::GetSelect() + for (CObject* obj : m_objMan->GetAllObjects()) + { + if (!obj->Implements(ObjectInterfaceType::Controllable)) continue; +- if (dynamic_cast(obj)->GetSelect()) ++ if (dynamic_cast(*obj).GetSelect()) + return obj; + } + return nullptr; +@@ -1964,7 +1964,7 @@ CObject* CRobotMain::DetectObject(Math::Point pos) + + CObject* transporter = nullptr; + if (obj->Implements(ObjectInterfaceType::Transportable)) +- transporter = dynamic_cast(obj)->GetTransporter(); ++ transporter = dynamic_cast(*obj).GetTransporter(); + + if (transporter != nullptr && !transporter->GetDetectable()) continue; + if (obj->GetProxyActivate()) continue; +@@ -1972,14 +1972,14 @@ CObject* CRobotMain::DetectObject(Math::Point pos) + CObject* target = obj; + if (obj->Implements(ObjectInterfaceType::PowerContainer) && obj->Implements(ObjectInterfaceType::Transportable)) + { +- target = dynamic_cast(obj)->GetTransporter(); // battery connected ++ target = dynamic_cast(*obj).GetTransporter(); // battery connected + if (target == nullptr) + { + target = obj; // standalone battery + } + else + { +- if (!target->Implements(ObjectInterfaceType::Powered) || dynamic_cast(target)->GetPower() != obj) ++ if (!target->Implements(ObjectInterfaceType::Powered) || dynamic_cast(*target).GetPower() != obj) + { + // transported, but not in the power slot + target = obj; +@@ -2009,7 +2009,7 @@ bool CRobotMain::DestroySelectedObject() + + m_engine->GetPyroManager()->Create(Gfx::PT_FRAGT, obj); + +- dynamic_cast(obj)->SetSelect(false); // deselects the object ++ dynamic_cast(*obj).SetSelect(false); // deselects the object + m_camera->SetType(Gfx::CAM_TYPE_EXPLO); + DeselectAll(); + RemoveFromSelectionHistory(obj); +@@ -2032,7 +2032,7 @@ void CRobotMain::HiliteClear() + for (CObject* obj : m_objMan->GetAllObjects()) + { + if (!obj->Implements(ObjectInterfaceType::Controllable)) continue; +- dynamic_cast(obj)->SetHighlight(false); ++ dynamic_cast(*obj).SetHighlight(false); + } + m_map->SetHighlight(nullptr); + m_short->SetHighlight(nullptr); +@@ -2092,12 +2092,12 @@ void CRobotMain::HiliteObject(Math::Point pos) + } + } + +- if (obj->Implements(ObjectInterfaceType::Controllable) && (dynamic_cast(obj)->GetSelectable() || m_cheatSelectInsect)) ++ if (obj->Implements(ObjectInterfaceType::Controllable) && (dynamic_cast(*obj).GetSelectable() || m_cheatSelectInsect)) + { +- if (dynamic_cast(obj)->GetSelectable()) ++ if (dynamic_cast(*obj).GetSelectable()) + { + // Don't highlight objects that would not be selectable without selectinsect +- dynamic_cast(obj)->SetHighlight(true); ++ dynamic_cast(*obj).SetHighlight(true); + } + m_map->SetHighlight(obj); + m_short->SetHighlight(obj); +@@ -2348,7 +2348,7 @@ bool CRobotMain::EventFrame(const Event &event) + if (obj->GetType() == OBJECT_TOTO) + toto = obj; + else if (obj->Implements(ObjectInterfaceType::Interactive)) +- dynamic_cast(obj)->EventProcess(event); ++ dynamic_cast(*obj).EventProcess(event); + + if ( obj->GetProxyActivate() ) // active if it is near? + { +@@ -2371,7 +2371,7 @@ bool CRobotMain::EventFrame(const Event &event) + continue; + + if (obj->Implements(ObjectInterfaceType::Interactive)) +- dynamic_cast(obj)->EventProcess(event); ++ dynamic_cast(*obj).EventProcess(event); + } + + m_engine->GetPyroManager()->EventProcess(event); +@@ -2395,7 +2395,7 @@ bool CRobotMain::EventFrame(const Event &event) + + // Advances toto following the camera, because its position depends on the camera. + if (toto != nullptr) +- dynamic_cast(toto)->EventProcess(event); ++ dynamic_cast(*toto).EventProcess(event); + + // NOTE: m_movieLock is set only after the first update of CAutoBase finishes + +@@ -2628,7 +2628,7 @@ bool CRobotMain::EventObject(const Event &event) + { + if (obj->Implements(ObjectInterfaceType::Interactive)) + { +- dynamic_cast(obj)->EventProcess(event); ++ dynamic_cast(*obj).EventProcess(event); + } + } + +@@ -2669,7 +2669,7 @@ void CRobotMain::ScenePerso() + obj->SetDrawFront(true); // draws the interface + + assert(obj->Implements(ObjectInterfaceType::Movable)); +- CMotionHuman* mh = static_cast(dynamic_cast(obj)->GetMotion()); ++ CMotionHuman* mh = static_cast(dynamic_cast(*obj).GetMotion()); + mh->StartDisplayPerso(); + } + } +@@ -3337,7 +3337,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) + assert(m_controller->Implements(ObjectInterfaceType::ProgramStorage)); + + assert(m_controller->Implements(ObjectInterfaceType::Old)); +- dynamic_cast(m_controller)->SetCheckToken(false); ++ dynamic_cast(*m_controller).SetCheckToken(false); + + if (line->GetParam("script")->IsDefined()) + { +@@ -3345,7 +3345,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) + Program* program = programStorage->AddProgram(); + programStorage->ReadProgram(program, line->GetParam("script")->AsPath("ai")); + program->readOnly = true; +- dynamic_cast(m_controller)->RunProgram(program); ++ dynamic_cast(*m_controller).RunProgram(program); + } + continue; + } +@@ -3370,7 +3370,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) + if (m_fixScene && obj->GetType() == OBJECT_HUMAN) + { + assert(obj->Implements(ObjectInterfaceType::Movable)); +- CMotion* motion = dynamic_cast(obj)->GetMotion(); ++ CMotion* motion = dynamic_cast(*obj).GetMotion(); + if (m_phase == PHASE_WIN ) motion->SetAction(MHS_WIN, 0.4f); + if (m_phase == PHASE_LOST) motion->SetAction(MHS_LOST, 0.5f); + } +@@ -3385,7 +3385,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) + { + CProgramStorageObject* programStorage = dynamic_cast(obj); + +- if (obj->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(obj)->GetSelectable() && obj->GetType() != OBJECT_HUMAN) ++ if (obj->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(*obj).GetSelectable() && obj->GetType() != OBJECT_HUMAN) + { + programStorage->SetProgramStorageIndex(rankObj); + } +@@ -3768,7 +3768,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) + assert(obj->Implements(ObjectInterfaceType::Controllable)); + SelectObject(obj); + m_camera->SetControllingObject(obj); +- m_camera->SetType(dynamic_cast(obj)->GetCameraType()); ++ m_camera->SetType(dynamic_cast(*obj).GetCameraType()); + } + } + +@@ -4363,7 +4363,7 @@ void CRobotMain::StartShowLimit() + CObject* obj = GetSelect(); + if (obj == nullptr) return; + if (!obj->Implements(ObjectInterfaceType::Ranged)) return; +- float range = dynamic_cast(obj)->GetShowLimitRadius(); ++ float range = dynamic_cast(*obj).GetShowLimitRadius(); + if (range == 0.0f) return; + SetShowLimit(0, Gfx::PARTILIMIT1, obj, obj->GetPosition(), range); + } +@@ -4503,8 +4503,8 @@ bool CRobotMain::IOIsBusy() + { + if (! obj->Implements(ObjectInterfaceType::TaskExecutor)) continue; + +- if (obj->Implements(ObjectInterfaceType::Programmable) && dynamic_cast(obj)->IsProgram()) continue; // TODO: I'm not sure if this is correct but this is how it worked earlier +- if (dynamic_cast(obj)->IsForegroundTask()) return true; ++ if (obj->Implements(ObjectInterfaceType::Programmable) && dynamic_cast(*obj).IsProgram()) continue; // TODO: I'm not sure if this is correct but this is how it worked earlier ++ if (dynamic_cast(*obj).IsForegroundTask()) return true; + } + return false; + } +@@ -4555,7 +4555,7 @@ void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj, const std:: + + if (obj->Implements(ObjectInterfaceType::Programmable)) + { +- int run = dynamic_cast(obj)->GetProgramIndex(dynamic_cast(obj)->GetCurrentProgram()); ++ int run = dynamic_cast(*obj).GetProgramIndex(dynamic_cast(*obj).GetCurrentProgram()); + if (run != -1) + { + line->AddParam("run", MakeUnique(run+1)); +@@ -4630,11 +4630,11 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s + { + if (obj->GetType() == OBJECT_TOTO) continue; + if (IsObjectBeingTransported(obj)) continue; +- if (obj->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(obj)->IsDying()) continue; ++ if (obj->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(*obj).IsDying()) continue; + + if (obj->Implements(ObjectInterfaceType::Carrier)) + { +- CObject* cargo = dynamic_cast(obj)->GetCargo(); ++ CObject* cargo = dynamic_cast(*obj).GetCargo(); + if (cargo != nullptr) // object transported? + { + line = MakeUnique("CreateFret"); +@@ -4645,7 +4645,7 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s + + if (obj->Implements(ObjectInterfaceType::Powered)) + { +- CObject* power = dynamic_cast(obj)->GetPower(); ++ CObject* power = dynamic_cast(*obj).GetPower(); + if (power != nullptr) // battery transported? + { + line = MakeUnique("CreatePower"); +@@ -4683,7 +4683,7 @@ bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, std::s + { + if (obj->GetType() == OBJECT_TOTO) continue; + if (IsObjectBeingTransported(obj)) continue; +- if (obj->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(obj)->IsDying()) continue; ++ if (obj->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(*obj).IsDying()) continue; + + if (!SaveFileStack(obj, file, objRank++)) break; + } +@@ -4824,7 +4824,7 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot) + { + assert(obj->Implements(ObjectInterfaceType::Carrier)); // TODO: exception? + assert(obj->Implements(ObjectInterfaceType::Old)); +- dynamic_cast(obj)->SetCargo(cargo); ++ dynamic_cast(*obj).SetCargo(cargo); + auto task = MakeUnique(dynamic_cast(obj)); + task->Start(TMO_AUTO, TMA_GRAB); // holds the object! + } +@@ -4832,9 +4832,9 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot) + if (power != nullptr) + { + assert(obj->Implements(ObjectInterfaceType::Powered)); +- dynamic_cast(obj)->SetPower(power); ++ dynamic_cast(*obj).SetPower(power); + assert(power->Implements(ObjectInterfaceType::Transportable)); +- dynamic_cast(power)->SetTransporter(obj); ++ dynamic_cast(*power).SetTransporter(obj); + } + cargo = nullptr; + power = nullptr; +@@ -4861,7 +4861,7 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot) + { + if (obj->GetType() == OBJECT_TOTO) continue; + if (IsObjectBeingTransported(obj)) continue; +- if (obj->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(obj)->IsDying()) continue; ++ if (obj->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(*obj).IsDying()) continue; + + if (!ReadFileStack(obj, file, objRank++)) break; + } +@@ -5204,7 +5204,7 @@ Error CRobotMain::CheckEndMission(bool frame) + if (m_base != nullptr && !m_endTakeImmediat) + { + assert(m_base->Implements(ObjectInterfaceType::Controllable)); +- if(dynamic_cast(m_base)->GetSelectable()) ++ if(dynamic_cast(*m_base).GetSelectable()) + return ERR_MISSION_NOTERM; + } + } +diff --git a/src/level/scene_conditions.cpp b/src/level/scene_conditions.cpp +index 263ee39..1a98e53 100644 +--- a/src/level/scene_conditions.cpp ++++ b/src/level/scene_conditions.cpp +@@ -82,7 +82,7 @@ bool CObjectCondition::CheckForObject(CObject* obj) + } + else if (obj->Implements(ObjectInterfaceType::Powered)) + { +- CObject* powerObj = dynamic_cast(obj)->GetPower(); ++ CObject* powerObj = dynamic_cast(*obj).GetPower(); + if(powerObj != nullptr && powerObj->Implements(ObjectInterfaceType::PowerContainer)) + { + power = dynamic_cast(powerObj); +@@ -98,7 +98,7 @@ bool CObjectCondition::CheckForObject(CObject* obj) + + Math::Vector oPos; + if (IsObjectBeingTransported(obj)) +- oPos = dynamic_cast(obj)->GetTransporter()->GetPosition(); ++ oPos = dynamic_cast(*obj).GetTransporter()->GetPosition(); + else + oPos = obj->GetPosition(); + oPos.y = 0.0f; +diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp +index 32b2428..da35ace 100644 +--- a/src/object/auto/autobase.cpp ++++ b/src/object/auto/autobase.cpp +@@ -169,7 +169,7 @@ begin: + else + { + assert(pObj->Implements(ObjectInterfaceType::Controllable)); +- m_camera->SetType(dynamic_cast(pObj)->GetCameraType()); ++ m_camera->SetType(dynamic_cast(*pObj).GetCameraType()); + } + + m_main->StartMusic(); +@@ -594,7 +594,7 @@ begin: + else + { + assert(pObj->Implements(ObjectInterfaceType::Controllable)); +- m_camera->SetType(dynamic_cast(pObj)->GetCameraType()); ++ m_camera->SetType(dynamic_cast(*pObj).GetCameraType()); + } + m_sound->Play(SOUND_BOUM, m_object->GetPosition()); + m_soundChannel = -1; +@@ -1124,7 +1124,7 @@ bool CAutoBase::Abort() + else + { + assert(pObj->Implements(ObjectInterfaceType::Controllable)); +- m_camera->SetType(dynamic_cast(pObj)->GetCameraType()); ++ m_camera->SetType(dynamic_cast(*pObj).GetCameraType()); + } + + m_engine->SetFogStart(m_fogStart); +@@ -1246,7 +1246,7 @@ void CAutoBase::FreezeCargo(bool freeze) + m_cargoObjects.insert(obj); + if ( obj->Implements(ObjectInterfaceType::Movable) ) + { +- CPhysics* physics = dynamic_cast(obj)->GetPhysics(); ++ CPhysics* physics = dynamic_cast(*obj).GetPhysics(); + physics->SetFreeze(freeze); + } + } +diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp +index ccb3cbd..4a778a8 100644 +--- a/src/object/auto/autodestroyer.cpp ++++ b/src/object/auto/autodestroyer.cpp +@@ -176,7 +176,7 @@ bool CAutoDestroyer::EventProcess(const Event &event) + if ( scrap != nullptr ) + { + assert(scrap->Implements(ObjectInterfaceType::Destroyable)); +- dynamic_cast(scrap)->DestroyObject(DestructionType::Explosion); ++ dynamic_cast(*scrap).DestroyObject(DestructionType::Explosion); + } + m_bExplo = true; + } +diff --git a/src/object/auto/autoegg.cpp b/src/object/auto/autoegg.cpp +index 7ea3e75..a92d43a 100644 +--- a/src/object/auto/autoegg.cpp ++++ b/src/object/auto/autoegg.cpp +@@ -74,7 +74,7 @@ void CAutoEgg::DeleteObject(bool all) + alien->SetLock(false); + if (alien->Implements(ObjectInterfaceType::Programmable)) + { +- dynamic_cast(alien)->SetActivity(true); // the insect is active ++ dynamic_cast(*alien).SetActivity(true); // the insect is active + } + } + else +@@ -123,7 +123,7 @@ void CAutoEgg::Init() + + if (alien->Implements(ObjectInterfaceType::Programmable)) + { +- dynamic_cast(alien)->SetActivity(false); ++ dynamic_cast(*alien).SetActivity(false); + } + } + +@@ -204,7 +204,7 @@ bool CAutoEgg::EventProcess(const Event &event) + if ( alien == nullptr ) return true; + if (alien->Implements(ObjectInterfaceType::Programmable)) + { +- dynamic_cast(alien)->SetActivity(false); ++ dynamic_cast(*alien).SetActivity(false); + } + + m_progress += event.rTime*m_speed; +@@ -265,7 +265,7 @@ Error CAutoEgg::IsEnded() + alien->SetLock(false); + if(alien->Implements(ObjectInterfaceType::Programmable)) + { +- dynamic_cast(alien)->SetActivity(true); // the insect is active ++ dynamic_cast(*alien).SetActivity(true); // the insect is active + } + } + +diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp +index 343d57b..c66e431 100644 +--- a/src/object/auto/autofactory.cpp ++++ b/src/object/auto/autofactory.cpp +@@ -392,7 +392,7 @@ bool CAutoFactory::EventProcess(const Event &event) + if ( vehicle != nullptr ) + { + assert(vehicle->Implements(ObjectInterfaceType::Movable)); +- physics = dynamic_cast(vehicle)->GetPhysics(); ++ physics = dynamic_cast(*vehicle).GetPhysics(); + physics->SetFreeze(false); // can move + + vehicle->SetLock(false); // vehicle useable +@@ -403,7 +403,7 @@ bool CAutoFactory::EventProcess(const Event &event) + { + if (vehicle->Implements(ObjectInterfaceType::Programmable) && vehicle->Implements(ObjectInterfaceType::ProgramStorage)) + { +- Program* program = dynamic_cast(vehicle)->AddProgram(); ++ Program* program = dynamic_cast(*vehicle).AddProgram(); + + if (boost::regex_match(m_program, boost::regex("[A-Za-z0-9_]+"))) // Public function name? + { +@@ -419,7 +419,7 @@ bool CAutoFactory::EventProcess(const Event &event) + program->script->SendScript(m_program.c_str()); + } + +- dynamic_cast(vehicle)->RunProgram(program); ++ dynamic_cast(*vehicle).RunProgram(program); + } + } + } +@@ -658,7 +658,7 @@ bool CAutoFactory::CreateVehicle() + vehicle->SetLock(true); // not usable + + assert(vehicle->Implements(ObjectInterfaceType::Movable)); +- CPhysics* physics = dynamic_cast(vehicle)->GetPhysics(); ++ CPhysics* physics = dynamic_cast(*vehicle).GetPhysics(); + physics->SetFreeze(true); // it doesn't move + + if (vehicle->Implements(ObjectInterfaceType::ProgramStorage)) +diff --git a/src/object/auto/autonuclearplant.cpp b/src/object/auto/autonuclearplant.cpp +index a341c45..2974fcf 100644 +--- a/src/object/auto/autonuclearplant.cpp ++++ b/src/object/auto/autonuclearplant.cpp +@@ -394,7 +394,7 @@ void CAutoNuclearPlant::CreatePower() + float powerLevel = 1.0f; + CObject* power = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_ATOMIC, powerLevel); + +- dynamic_cast(power)->SetTransporter(m_object); ++ dynamic_cast(*power).SetTransporter(m_object); + power->SetPosition(Math::Vector(22.0f, 3.0f, 0.0f)); + m_object->SetPower(power); + } +diff --git a/src/object/auto/autopowercaptor.cpp b/src/object/auto/autopowercaptor.cpp +index fea4586..34f9fe0 100644 +--- a/src/object/auto/autopowercaptor.cpp ++++ b/src/object/auto/autopowercaptor.cpp +@@ -269,7 +269,7 @@ void CAutoPowerCaptor::ChargeObject(float rTime) + + if (obj->Implements(ObjectInterfaceType::Powered)) + { +- CObject* power = dynamic_cast(obj)->GetPower(); ++ CObject* power = dynamic_cast(*obj).GetPower(); + if ( power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer) ) + { + CPowerContainerObject* powerContainer = dynamic_cast(power); +@@ -285,7 +285,7 @@ void CAutoPowerCaptor::ChargeObject(float rTime) + + if (obj->Implements(ObjectInterfaceType::Carrier)) + { +- CObject* power = dynamic_cast(obj)->GetCargo(); ++ CObject* power = dynamic_cast(*obj).GetCargo(); + if ( power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer) ) + { + CPowerContainerObject* powerContainer = dynamic_cast(power); +diff --git a/src/object/auto/autopowerplant.cpp b/src/object/auto/autopowerplant.cpp +index d7294b9..690e20a 100644 +--- a/src/object/auto/autopowerplant.cpp ++++ b/src/object/auto/autopowerplant.cpp +@@ -331,7 +331,7 @@ bool CAutoPowerPlant::EventProcess(const Event &event) + + cargo->SetScale(1.0f); + cargo->SetLock(false); // usable battery +- dynamic_cast(cargo)->SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporter(m_object); + cargo->SetPosition(Math::Vector(0.0f, 3.0f, 0.0f)); + m_object->SetPower(cargo); + +diff --git a/src/object/auto/autopowerstation.cpp b/src/object/auto/autopowerstation.cpp +index 5b90b6f..9271013 100644 +--- a/src/object/auto/autopowerstation.cpp ++++ b/src/object/auto/autopowerstation.cpp +@@ -138,7 +138,7 @@ bool CAutoPowerStation::EventProcess(const Event &event) + { + if (vehicle->Implements(ObjectInterfaceType::Powered)) + { +- CObject* power = dynamic_cast(vehicle)->GetPower(); ++ CObject* power = dynamic_cast(*vehicle).GetPower(); + if ( power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer) ) + { + CPowerContainerObject* powerContainer = dynamic_cast(power); +@@ -158,7 +158,7 @@ bool CAutoPowerStation::EventProcess(const Event &event) + + if (vehicle->Implements(ObjectInterfaceType::Carrier)) + { +- CObject* power = dynamic_cast(vehicle)->GetCargo(); ++ CObject* power = dynamic_cast(*vehicle).GetCargo(); + if ( power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer) ) + { + CPowerContainerObject* powerContainer = dynamic_cast(power); +diff --git a/src/object/auto/autorepair.cpp b/src/object/auto/autorepair.cpp +index d580ce8..2ff6eaa 100644 +--- a/src/object/auto/autorepair.cpp ++++ b/src/object/auto/autorepair.cpp +@@ -148,7 +148,7 @@ bool CAutoRepair::EventProcess(const Event &event) + assert(vehicle->Implements(ObjectInterfaceType::Shielded)); + + if ( m_progress < 1.0f || +- (vehicle != nullptr && dynamic_cast(vehicle)->GetShield() < 1.0f) ) ++ (vehicle != nullptr && dynamic_cast(*vehicle).GetShield() < 1.0f) ) + { + if ( vehicle != nullptr ) + { +@@ -243,9 +243,9 @@ CObject* CAutoRepair::SearchVehicle() + { + if (obj == m_object) continue; + if ( !obj->Implements(ObjectInterfaceType::Shielded) ) continue; +- if ( !dynamic_cast(obj)->IsRepairable() ) continue; ++ if ( !dynamic_cast(*obj).IsRepairable() ) continue; + +- if ( obj->Implements(ObjectInterfaceType::Movable) && !dynamic_cast(obj)->GetPhysics()->GetLand() ) continue; // in flight? ++ if ( obj->Implements(ObjectInterfaceType::Movable) && !dynamic_cast(*obj).GetPhysics()->GetLand() ) continue; // in flight? + + Math::Vector oPos = obj->GetPosition(); + float dist = Math::Distance(oPos, sPos); +diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp +index 053d29d..6ab241e 100644 +--- a/src/object/auto/autotower.cpp ++++ b/src/object/auto/autotower.cpp +@@ -289,7 +289,7 @@ CObject* CAutoTower::SearchTarget(Math::Vector &impact) + { + if ( obj->Implements(ObjectInterfaceType::Movable) ) + { +- CPhysics* physics = dynamic_cast(obj)->GetPhysics(); ++ CPhysics* physics = dynamic_cast(*obj).GetPhysics(); + float speed = fabs(physics->GetLinMotionX(MO_REASPEED)); + if ( speed > 20.0f ) continue; // moving too fast? + } +@@ -302,8 +302,7 @@ CObject* CAutoTower::SearchTarget(Math::Vector &impact) + if ( distance > TOWER_SCOPE ) continue; // too far + if ( distance < min ) + { +- min = distance; +- best = obj; ++ min = distance; best = obj; + } + } + if ( best == nullptr ) return nullptr; +@@ -327,7 +326,7 @@ Error CAutoTower::GetError() + return ERR_TOWER_POWER; // no battery + } + +- if ( dynamic_cast(m_object->GetPower())->GetEnergy() < ENERGY_FIRE ) ++ if ( dynamic_cast(*m_object->GetPower()).GetEnergy() < ENERGY_FIRE ) + { + return ERR_TOWER_ENERGY; // not enough energy + } +diff --git a/src/object/implementation/program_storage_impl.cpp b/src/object/implementation/program_storage_impl.cpp +index 8d59a86..c82adc9 100644 +--- a/src/object/implementation/program_storage_impl.cpp ++++ b/src/object/implementation/program_storage_impl.cpp +@@ -270,7 +270,7 @@ void CProgramStorageObjectImpl::LoadAllProgramsForLevel(CLevelParserLine* levelS + + if (m_object->Implements(ObjectInterfaceType::Programmable) && i == run) + { +- dynamic_cast(m_object)->RunProgram(program); ++ dynamic_cast(*m_object).RunProgram(program); + } + } + else +@@ -327,7 +327,7 @@ void CProgramStorageObjectImpl::SaveAllProgramsForSavedScene(CLevelParserLine* l + } + + if (m_programStorageIndex < 0) return; +- if (!m_object->Implements(ObjectInterfaceType::Controllable) || !dynamic_cast(m_object)->GetSelectable() || m_object->GetType() == OBJECT_HUMAN) return; ++ if (!m_object->Implements(ObjectInterfaceType::Controllable) || !dynamic_cast(*m_object).GetSelectable() || m_object->GetType() == OBJECT_HUMAN) return; + + GetLogger()->Debug("Saving saved scene programs to '%s/prog%.3d___.txt'\n", levelSource.c_str(), m_programStorageIndex); + for (unsigned int i = 0; i < m_program.size(); i++) +@@ -379,7 +379,7 @@ void CProgramStorageObjectImpl::LoadAllProgramsForSavedScene(CLevelParserLine* l + + if (m_object->Implements(ObjectInterfaceType::Programmable) && i == run) + { +- dynamic_cast(m_object)->RunProgram(program); ++ dynamic_cast(*m_object).RunProgram(program); + } + } + } +@@ -403,7 +403,7 @@ void CProgramStorageObjectImpl::LoadAllProgramsForSavedScene(CLevelParserLine* l + + if (m_object->Implements(ObjectInterfaceType::Programmable) && i == run) + { +- dynamic_cast(m_object)->RunProgram(program); ++ dynamic_cast(*m_object).RunProgram(program); + } + } + } +diff --git a/src/object/implementation/programmable_impl.cpp b/src/object/implementation/programmable_impl.cpp +index 5e370bd..b4db83f 100644 +--- a/src/object/implementation/programmable_impl.cpp ++++ b/src/object/implementation/programmable_impl.cpp +@@ -68,7 +68,7 @@ bool CProgrammableObjectImpl::EventProcess(const Event &event) + { + if (event.type == EVENT_FRAME) + { +- if ( m_object->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(m_object)->IsDying() && IsProgram() ) ++ if ( m_object->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(*m_object).IsDying() && IsProgram() ) + { + StopProgram(); + } +@@ -113,7 +113,7 @@ void CProgrammableObjectImpl::RunProgram(Program* program) + { + m_currentProgram = program; // start new program + m_object->UpdateInterface(); +- if (m_object->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(m_object)->GetTrainer()) ++ if (m_object->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(*m_object).GetTrainer()) + CRobotMain::GetInstancePointer()->StartMissionTimer(); + } + } +@@ -155,8 +155,8 @@ bool CProgrammableObjectImpl::ReadStack(FILE *file) + { + if (m_object->Implements(ObjectInterfaceType::ProgramStorage)) + { +- assert(op < static_cast(dynamic_cast(m_object)->GetProgramCount())); +- m_currentProgram = dynamic_cast(m_object)->GetProgram(op); ++ assert(op < static_cast(dynamic_cast(*m_object).GetProgramCount())); ++ m_currentProgram = dynamic_cast(*m_object).GetProgram(op); + if ( !m_currentProgram->script->ReadStack(file) ) return false; + } + else +@@ -184,7 +184,7 @@ bool CProgrammableObjectImpl::WriteStack(FILE *file) + op = -1; + if (m_object->Implements(ObjectInterfaceType::ProgramStorage)) + { +- op = dynamic_cast(m_object)->GetProgramIndex(m_currentProgram); ++ op = dynamic_cast(*m_object).GetProgramIndex(m_currentProgram); + } + CBot::fWrite(&op, sizeof(short), 1, file); + +@@ -243,7 +243,7 @@ void CProgrammableObjectImpl::TraceRecordFrame() + assert(m_object->Implements(ObjectInterfaceType::TraceDrawing)); + CTraceDrawingObject* traceDrawing = dynamic_cast(m_object); + +- CPhysics* physics = dynamic_cast(m_object)->GetPhysics(); ++ CPhysics* physics = dynamic_cast(*m_object).GetPhysics(); + + speed = physics->GetLinMotionX(MO_REASPEED); + if ( speed > 0.0f ) oper = TO_ADVANCE; +@@ -330,7 +330,7 @@ void CProgrammableObjectImpl::TraceRecordStop() + buffer << "}\n"; + + assert(m_object->Implements(ObjectInterfaceType::ProgramStorage)); +- Program* prog = dynamic_cast(m_object)->AddProgram(); ++ Program* prog = dynamic_cast(*m_object).AddProgram(); + prog->script->SendScript(buffer.str().c_str()); + } + +diff --git a/src/object/motion/motionant.cpp b/src/object/motion/motionant.cpp +index bee3114..85b46b1 100644 +--- a/src/object/motion/motionant.cpp ++++ b/src/object/motion/motionant.cpp +@@ -429,7 +429,7 @@ bool CMotionAnt::EventFrame(const Event &event) + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); + if ( dynamic_cast(m_object)->GetDying() == DeathType::Burning ) // burning? + { +- if ( dynamic_cast(m_object)->GetFixed() ) ++ if ( dynamic_cast(*m_object).GetFixed() ) + { + m_actionType = MAS_BURN; + } +@@ -724,7 +724,7 @@ bool CMotionAnt::EventFrame(const Event &event) + if ( m_progress >= 1.0f ) + { + SetAction(-1); +- dynamic_cast(m_object)->SetFixed(false); // moving again ++ dynamic_cast(*m_object).SetFixed(false); // moving again + } + } + else +diff --git a/src/object/motion/motionspider.cpp b/src/object/motion/motionspider.cpp +index 4aa046a..aa195f4 100644 +--- a/src/object/motion/motionspider.cpp ++++ b/src/object/motion/motionspider.cpp +@@ -364,7 +364,7 @@ bool CMotionSpider::EventFrame(const Event &event) + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); + if (dynamic_cast(m_object)->GetDying() == DeathType::Burning ) // burning? + { +- if ( dynamic_cast(m_object)->GetFixed() ) ++ if ( dynamic_cast(*m_object).GetFixed() ) + { + m_actionType = MSS_BURN; + } +@@ -648,7 +648,7 @@ bool CMotionSpider::EventFrame(const Event &event) + if ( m_progress >= 1.0f ) + { + SetAction(-1); +- dynamic_cast(m_object)->SetFixed(false); // moving again ++ dynamic_cast(*m_object).SetFixed(false); // moving again + } + } + else +diff --git a/src/object/motion/motionvehicle.cpp b/src/object/motion/motionvehicle.cpp +index fa631fd..cc15f25 100644 +--- a/src/object/motion/motionvehicle.cpp ++++ b/src/object/motion/motionvehicle.cpp +@@ -928,7 +928,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type, + + powerCell->SetPosition(powerCellPos); + powerCell->SetRotation(Math::Vector(0.0f, powerCellAngle, 0.0f)); +- dynamic_cast(powerCell)->SetTransporter(m_object); ++ dynamic_cast(*powerCell).SetTransporter(m_object); + assert(m_object->Implements(ObjectInterfaceType::Powered)); + m_object->SetPower(powerCell); + } +diff --git a/src/object/object_manager.cpp b/src/object/object_manager.cpp +index 0b4daed..2651a5e 100644 +--- a/src/object/object_manager.cpp ++++ b/src/object/object_manager.cpp +@@ -205,7 +205,7 @@ void CObjectManager::DestroyTeam(int team, DestructionType destructionType) + { + if (object->Implements(ObjectInterfaceType::Destroyable)) + { +- dynamic_cast(object)->DestroyObject(destructionType); ++ dynamic_cast(*object).DestroyObject(destructionType); + } + else + { +@@ -324,7 +324,7 @@ std::vector CObjectManager::RadarAll(CObject* pThis, Math::Vector this + { + if ( pObj->Implements(ObjectInterfaceType::Movable) ) + { +- CPhysics* physics = dynamic_cast(pObj)->GetPhysics(); ++ CPhysics* physics = dynamic_cast(*pObj).GetPhysics(); + if ( physics != nullptr ) + { + if ( !physics->GetLand() ) continue; +@@ -334,7 +334,7 @@ std::vector CObjectManager::RadarAll(CObject* pThis, Math::Vector this + if ( filter_flying == FILTER_ONLYFLYING ) + { + if ( !pObj->Implements(ObjectInterfaceType::Movable) ) continue; +- CPhysics* physics = dynamic_cast(pObj)->GetPhysics(); ++ CPhysics* physics = dynamic_cast(*pObj).GetPhysics(); + if ( physics == nullptr ) continue; + if ( physics->GetLand() ) continue; + } +diff --git a/src/object/old_object.cpp b/src/object/old_object.cpp +index 3ecbb0e..f5d80b5 100644 +--- a/src/object/old_object.cpp ++++ b/src/object/old_object.cpp +@@ -285,8 +285,8 @@ void COldObject::DeleteObject(bool bAll) + { + if (m_power->Implements(ObjectInterfaceType::Old)) + { +- dynamic_cast(m_power)->SetTransporter(nullptr); +- dynamic_cast(m_power)->DeleteObject(bAll); ++ dynamic_cast(*m_power).SetTransporter(nullptr); ++ dynamic_cast(*m_power).DeleteObject(bAll); + } + m_power = nullptr; + } +@@ -294,8 +294,8 @@ void COldObject::DeleteObject(bool bAll) + { + if (m_cargo->Implements(ObjectInterfaceType::Old)) + { +- dynamic_cast(m_cargo)->SetTransporter(nullptr); +- dynamic_cast(m_cargo)->DeleteObject(bAll); ++ dynamic_cast(*m_cargo).SetTransporter(nullptr); ++ dynamic_cast(*m_cargo).DeleteObject(bAll); + } + m_cargo = nullptr; + } +diff --git a/src/object/task/taskfire.cpp b/src/object/task/taskfire.cpp +index 590ce94..65ad8ee 100644 +--- a/src/object/task/taskfire.cpp ++++ b/src/object/task/taskfire.cpp +@@ -317,7 +317,7 @@ Error CTaskFire::Start(float delay) + CObject* power = dynamic_cast(m_object)->GetPower(); + if (power == nullptr || !power->Implements(ObjectInterfaceType::PowerContainer)) return ERR_FIRE_ENERGY; + +- energy = dynamic_cast(power)->GetEnergy(); ++ energy = dynamic_cast(*power).GetEnergy(); + if ( m_bOrganic ) fire = m_delay*ENERGY_FIREi; + else if ( m_bRay ) fire = m_delay*ENERGY_FIREr; + else fire = m_delay*ENERGY_FIRE; +diff --git a/src/object/task/taskfireant.cpp b/src/object/task/taskfireant.cpp +index 35ddac7..57f5d2a 100644 +--- a/src/object/task/taskfireant.cpp ++++ b/src/object/task/taskfireant.cpp +@@ -60,7 +60,7 @@ bool CTaskFireAnt::EventProcess(const Event &event) + if ( event.type != EVENT_FRAME ) return true; + if ( m_bError ) return false; + +- if ( dynamic_cast(m_object)->GetFixed() ) // insect on its back? ++ if ( dynamic_cast(*m_object).GetFixed() ) // insect on its back? + { + m_bError = true; + return false; +@@ -100,7 +100,7 @@ Error CTaskFireAnt::Start(Math::Vector impact) + if ( type != OBJECT_ANT ) return ERR_WRONG_BOT; + + // Insect on its back? +- if ( dynamic_cast(m_object)->GetFixed() ) return ERR_WRONG_BOT; ++ if ( dynamic_cast(*m_object).GetFixed() ) return ERR_WRONG_BOT; + + m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f)); + +@@ -130,7 +130,7 @@ Error CTaskFireAnt::IsEnded() + + if ( m_engine->GetPause() ) return ERR_CONTINUE; + if ( m_bError ) return ERR_STOP; +- if ( dynamic_cast(m_object)->GetFixed() ) return ERR_STOP; // insect on its back? ++ if ( dynamic_cast(*m_object).GetFixed() ) return ERR_STOP; // insect on its back? + + if ( m_phase == TFA_TURN ) // rotation ? + { +diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp +index e1b3954..b334ed8 100644 +--- a/src/object/task/taskgoto.cpp ++++ b/src/object/task/taskgoto.cpp +@@ -1189,7 +1189,7 @@ bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance) + type == OBJECT_MOBILEdr ) + { + assert(pObj->Implements(ObjectInterfaceType::Powered)); +- pos = dynamic_cast(pObj)->GetPowerPosition(); ++ pos = dynamic_cast(*pObj).GetPowerPosition(); + pos.x -= TAKE_DIST+TAKE_DIST_OTHER+distance; + mat = pObj->GetWorldMatrix(0); + pos = Transform(*mat, pos); +diff --git a/src/object/task/taskmanip.cpp b/src/object/task/taskmanip.cpp +index 16615eb..c697ec1 100644 +--- a/src/object/task/taskmanip.cpp ++++ b/src/object/task/taskmanip.cpp +@@ -304,8 +304,8 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm) + assert(other->Implements(ObjectInterfaceType::Transportable)); + + m_object->SetCargo(other); // takes the ball +- dynamic_cast(other)->SetTransporter(m_object); +- dynamic_cast(other)->SetTransporterPart(0); // taken with the base ++ dynamic_cast(*other).SetTransporter(m_object); ++ dynamic_cast(*other).SetTransporterPart(0); // taken with the base + other->SetPosition(Math::Vector(0.0f, -3.0f, 0.0f)); + } + else +@@ -314,7 +314,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm) + assert(other->Implements(ObjectInterfaceType::Transportable)); + + m_object->SetCargo(nullptr); // lick the ball +- dynamic_cast(other)->SetTransporter(nullptr); ++ dynamic_cast(*other).SetTransporter(nullptr); + pos = m_object->GetPosition(); + pos.y -= 3.0f; + other->SetPosition(pos); +@@ -903,7 +903,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos, + ObjectType type = pObj->GetType(); + if ( !pObj->Implements(ObjectInterfaceType::Powered) ) continue; + +- CObject* power = dynamic_cast(pObj)->GetPower(); ++ CObject* power = dynamic_cast(*pObj).GetPower(); + if (power != nullptr) + { + if (power->GetLock()) continue; +@@ -911,7 +911,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos, + } + + mat = pObj->GetWorldMatrix(0); +- Math::Vector oPos = Transform(*mat, dynamic_cast(pObj)->GetPowerPosition()); ++ Math::Vector oPos = Transform(*mat, dynamic_cast(*pObj).GetPowerPosition()); + + oAngle = pObj->GetRotationY(); + if ( type == OBJECT_TOWER || +@@ -946,7 +946,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos, + angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! + if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) ) + { +- Math::Vector powerPos = dynamic_cast(pObj)->GetPowerPosition(); ++ Math::Vector powerPos = dynamic_cast(*pObj).GetPowerPosition(); + height = powerPos.y; + pos = oPos; + return pObj; +@@ -974,8 +974,8 @@ bool CTaskManip::TransporterTakeObject() + if ( m_object->GetType() == OBJECT_HUMAN || + m_object->GetType() == OBJECT_TECH ) + { +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(4); // takes with the hand ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(4); // takes with the hand + + cargo->SetPosition(Math::Vector(1.7f, -0.5f, 1.1f)); + cargo->SetRotationY(0.1f); +@@ -984,8 +984,8 @@ bool CTaskManip::TransporterTakeObject() + } + else if ( m_bSubm ) + { +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(2); // takes with the right claw ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(2); // takes with the right claw + + Math::Vector pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative + cargo->SetPosition(pos); +@@ -995,8 +995,8 @@ bool CTaskManip::TransporterTakeObject() + } + else + { +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(3); // takes with the hand ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(3); // takes with the hand + + Math::Vector pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) + cargo->SetPosition(pos); +@@ -1020,8 +1020,8 @@ bool CTaskManip::TransporterTakeObject() + + if ( m_bSubm ) + { +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(2); // takes with the right claw ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(2); // takes with the right claw + + pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative + cargo->SetPosition(pos); +@@ -1031,8 +1031,8 @@ bool CTaskManip::TransporterTakeObject() + } + else + { +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(3); // takes with the hand ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(3); // takes with the hand + + pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) + cargo->SetPosition(pos); +@@ -1054,8 +1054,8 @@ bool CTaskManip::TransporterTakeObject() + + m_cargoType = cargo->GetType(); + +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(3); // takes with the hand ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(3); // takes with the hand + + pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) + cargo->SetPosition(pos); +@@ -1080,7 +1080,7 @@ bool CTaskManip::TransporterTakeObject() + cargo->SetRotationX(0.0f); + cargo->SetRotationZ(Math::PI/2.0f); + cargo->SetRotationY(0.0f); +- dynamic_cast(cargo)->SetTransporterPart(3); // takes with the hand ++ dynamic_cast(*cargo).SetTransporterPart(3); // takes with the hand + + m_object->SetPower(nullptr); + m_object->SetCargo(cargo); // takes +@@ -1094,15 +1094,15 @@ bool CTaskManip::TransporterTakeObject() + if (other == nullptr) return false; + assert(other->Implements(ObjectInterfaceType::Powered)); + +- CObject* cargo = dynamic_cast(other)->GetPower(); ++ CObject* cargo = dynamic_cast(*other).GetPower(); + if (cargo == nullptr) return false; // the other does not have a battery? + assert(cargo->Implements(ObjectInterfaceType::Transportable)); + + m_cargoType = cargo->GetType(); + +- dynamic_cast(other)->SetPower(nullptr); +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(3); // takes with the hand ++ dynamic_cast(*other).SetPower(nullptr); ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(3); // takes with the hand + + pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) + cargo->SetPosition(pos); +@@ -1137,7 +1137,7 @@ bool CTaskManip::TransporterDeposeObject() + cargo->SetRotationZ(0.0f); + cargo->FloorAdjust(); // plate well on the ground + +- dynamic_cast(cargo)->SetTransporter(nullptr); ++ dynamic_cast(*cargo).SetTransporter(nullptr); + m_object->SetCargo(nullptr); // deposit + } + +@@ -1157,7 +1157,7 @@ bool CTaskManip::TransporterDeposeObject() + cargo->SetRotationX(0.0f); + cargo->SetRotationZ(0.0f); + +- dynamic_cast(cargo)->SetTransporter(nullptr); ++ dynamic_cast(*cargo).SetTransporter(nullptr); + m_object->SetCargo(nullptr); // deposit + } + +@@ -1172,8 +1172,8 @@ bool CTaskManip::TransporterDeposeObject() + + if (m_object->GetPower() != nullptr) return false; + +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(0); // carried by the base ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(0); // carried by the base + + cargo->SetPosition(m_object->GetPowerPosition()); + cargo->SetRotationY(0.0f); +@@ -1193,7 +1193,7 @@ bool CTaskManip::TransporterDeposeObject() + if (other == nullptr) return false; + assert(other->Implements(ObjectInterfaceType::Powered)); + +- CObject* cargo = dynamic_cast(other)->GetPower(); ++ CObject* cargo = dynamic_cast(*other).GetPower(); + if (cargo != nullptr) return false; // the other already has a battery? + + cargo = m_object->GetCargo(); +@@ -1202,14 +1202,14 @@ bool CTaskManip::TransporterDeposeObject() + + m_cargoType = cargo->GetType(); + +- dynamic_cast(other)->SetPower(cargo); +- dynamic_cast(cargo)->SetTransporter(other); ++ dynamic_cast(*other).SetPower(cargo); ++ dynamic_cast(*cargo).SetTransporter(other); + +- cargo->SetPosition(dynamic_cast(other)->GetPowerPosition()); ++ cargo->SetPosition(dynamic_cast(*other).GetPowerPosition()); + cargo->SetRotationY(0.0f); + cargo->SetRotationX(0.0f); + cargo->SetRotationZ(0.0f); +- dynamic_cast(cargo)->SetTransporterPart(0); // carried by the base ++ dynamic_cast(*cargo).SetTransporterPart(0); // carried by the base + + m_object->SetCargo(nullptr); // deposit + } +diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp +index 872632e..5f2cda5 100644 +--- a/src/object/task/taskrecover.cpp ++++ b/src/object/task/taskrecover.cpp +@@ -194,7 +194,7 @@ Error CTaskRecover::Start() + CObject* power = dynamic_cast(m_object)->GetPower(); + if (power == nullptr || !power->Implements(ObjectInterfaceType::PowerContainer)) return ERR_RECOVER_ENERGY; + +- float energy = dynamic_cast(power)->GetEnergy(); ++ float energy = dynamic_cast(*power).GetEnergy(); + if ( energy < ENERGY_RECOVER+0.05f ) return ERR_RECOVER_ENERGY; + + Math::Matrix* mat = m_object->GetWorldMatrix(0); +diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp +index 5408941..948163a 100644 +--- a/src/object/task/taskshield.cpp ++++ b/src/object/task/taskshield.cpp +@@ -309,7 +309,7 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay) + + CObject* power = m_object->GetPower(); + if (power == nullptr || !power->Implements(ObjectInterfaceType::PowerContainer)) return ERR_SHIELD_ENERGY; +- float energy = dynamic_cast(power)->GetEnergy(); ++ float energy = dynamic_cast(*power).GetEnergy(); + if ( energy == 0.0f ) return ERR_SHIELD_ENERGY; + + Math::Matrix* mat = m_object->GetWorldMatrix(0); +diff --git a/src/object/task/taskspiderexplo.cpp b/src/object/task/taskspiderexplo.cpp +index 03abddb..b988922 100644 +--- a/src/object/task/taskspiderexplo.cpp ++++ b/src/object/task/taskspiderexplo.cpp +@@ -57,7 +57,7 @@ bool CTaskSpiderExplo::EventProcess(const Event &event) + if ( event.type != EVENT_FRAME ) return true; + + // Momentarily stationary object (ant on the back)? +- if ( dynamic_cast(m_object)->GetFixed() ) ++ if ( dynamic_cast(*m_object).GetFixed() ) + { + m_bError = true; + return true; +diff --git a/src/object/task/tasktake.cpp b/src/object/task/tasktake.cpp +index c67a7e5..13bd7cd 100644 +--- a/src/object/task/tasktake.cpp ++++ b/src/object/task/tasktake.cpp +@@ -131,9 +131,9 @@ Error CTaskTake::Start() + CObject* other = SearchFriendObject(oAngle, 1.5f, Math::PI*0.50f); + if (other != nullptr) assert(other->Implements(ObjectInterfaceType::Powered)); + +- if (other != nullptr && dynamic_cast(other)->GetPower() != nullptr) ++ if (other != nullptr && dynamic_cast(*other).GetPower() != nullptr) + { +- CObject* power = dynamic_cast(other)->GetPower(); ++ CObject* power = dynamic_cast(*other).GetPower(); + type = power->GetType(); + if ( type == OBJECT_URANIUM ) return ERR_MANIP_RADIO; + assert(power->Implements(ObjectInterfaceType::Transportable)); +@@ -161,7 +161,7 @@ Error CTaskTake::Start() + CObject* other = SearchFriendObject(oAngle, 1.5f, Math::PI*0.50f); + if (other != nullptr) assert(other->Implements(ObjectInterfaceType::Powered)); + +- if (other != nullptr && dynamic_cast(other)->GetPower() == nullptr ) ++ if (other != nullptr && dynamic_cast(*other).GetPower() == nullptr ) + { + //? m_camera->StartCentering(m_object, Math::PI*0.3f, -Math::PI*0.1f, 0.0f, 0.8f); + m_arm = TTA_FRIEND; +@@ -384,7 +384,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle, + + assert(pObj->Implements(ObjectInterfaceType::Powered)); + +- CObject* power = dynamic_cast(pObj)->GetPower(); ++ CObject* power = dynamic_cast(*pObj).GetPower(); + if (power != nullptr) + { + if ( power->GetLock() ) continue; +@@ -392,7 +392,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle, + } + + Math::Matrix* mat = pObj->GetWorldMatrix(0); +- Math::Vector oPos = Math::Transform(*mat, dynamic_cast(pObj)->GetPowerPosition()); ++ Math::Vector oPos = Math::Transform(*mat, dynamic_cast(*pObj).GetPowerPosition()); + + float distance = fabs(Math::Distance(oPos, iPos) - (iRad+1.0f)); + if ( distance <= dLimit ) +@@ -400,7 +400,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle, + angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW ! + if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) ) + { +- Math::Vector powerPos = dynamic_cast(pObj)->GetPowerPosition(); ++ Math::Vector powerPos = dynamic_cast(*pObj).GetPowerPosition(); + m_height = powerPos.y; + return pObj; + } +@@ -424,8 +424,8 @@ bool CTaskTake::TransporterTakeObject() + + m_cargoType = cargo->GetType(); + +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(4); // takes with the hand ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(4); // takes with the hand + + //? cargo->SetPosition(Math::Vector(2.2f, -1.0f, 1.1f)); + cargo->SetPosition(Math::Vector(1.7f, -0.5f, 1.1f)); +@@ -443,15 +443,15 @@ bool CTaskTake::TransporterTakeObject() + if (other == nullptr) return false; + assert(other->Implements(ObjectInterfaceType::Powered)); + +- CObject* cargo = dynamic_cast(other)->GetPower(); ++ CObject* cargo = dynamic_cast(*other).GetPower(); + if (cargo == nullptr) return false; // the other does not have a battery? + assert(cargo->Implements(ObjectInterfaceType::Transportable)); + + m_cargoType = cargo->GetType(); + +- dynamic_cast(other)->SetPower(nullptr); +- dynamic_cast(cargo)->SetTransporter(m_object); +- dynamic_cast(cargo)->SetTransporterPart(4); // takes with the hand ++ dynamic_cast(*other).SetPower(nullptr); ++ dynamic_cast(*cargo).SetTransporter(m_object); ++ dynamic_cast(*cargo).SetTransporterPart(4); // takes with the hand + + //? cargo->SetPosition(Math::Vector(2.2f, -1.0f, 1.1f)); + cargo->SetPosition(Math::Vector(1.7f, -0.5f, 1.1f)); +@@ -486,7 +486,7 @@ bool CTaskTake::TransporterDeposeObject() + cargo->SetRotationZ(0.0f); + cargo->FloorAdjust(); // plate well on the ground + +- dynamic_cast(cargo)->SetTransporter(nullptr); ++ dynamic_cast(*cargo).SetTransporter(nullptr); + m_object->SetCargo(nullptr); // deposit + } + +@@ -497,7 +497,7 @@ bool CTaskTake::TransporterDeposeObject() + if (other == nullptr) return false; + assert(other->Implements(ObjectInterfaceType::Powered)); + +- CObject* cargo = dynamic_cast(other)->GetPower(); ++ CObject* cargo = dynamic_cast(*other).GetPower(); + if (cargo != nullptr) return false; // the other already has a battery? + + cargo = m_object->GetCargo(); +@@ -505,14 +505,14 @@ bool CTaskTake::TransporterDeposeObject() + assert(cargo->Implements(ObjectInterfaceType::Transportable)); + m_cargoType = cargo->GetType(); + +- dynamic_cast(other)->SetPower(cargo); +- dynamic_cast(cargo)->SetTransporter(other); ++ dynamic_cast(*other).SetPower(cargo); ++ dynamic_cast(*cargo).SetTransporter(other); + +- cargo->SetPosition(dynamic_cast(other)->GetPowerPosition()); ++ cargo->SetPosition(dynamic_cast(*other).GetPowerPosition()); + cargo->SetRotationY(0.0f); + cargo->SetRotationX(0.0f); + cargo->SetRotationZ(0.0f); +- dynamic_cast(cargo)->SetTransporterPart(0); // carried by the base ++ dynamic_cast(*cargo).SetTransporterPart(0); // carried by the base + + m_object->SetCargo(nullptr); // deposit + } +diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp +index 6718bb7..8bb25d6 100644 +--- a/src/object/task/taskterraform.cpp ++++ b/src/object/task/taskterraform.cpp +@@ -215,7 +215,7 @@ Error CTaskTerraform::Start() + + power = m_object->GetPower(); + if ( power == nullptr || !power->Implements(ObjectInterfaceType::PowerContainer) ) return ERR_TERRA_ENERGY; +- energy = dynamic_cast(power)->GetEnergy(); ++ energy = dynamic_cast(*power).GetEnergy(); + if ( energy < ENERGY_TERRA+0.05f ) return ERR_TERRA_ENERGY; + + speed = m_physics->GetMotorSpeed(); +@@ -459,7 +459,7 @@ bool CTaskTerraform::Terraform() + type == OBJECT_PARA) // Buildings? + { + if ( dist > 15.0f ) continue; +- dynamic_cast(pObj)->DamageObject(DamageType::Explosive, 0.2f); ++ dynamic_cast(*pObj).DamageObject(DamageType::Explosive, 0.2f); + } + else // Other? + { +@@ -470,7 +470,7 @@ bool CTaskTerraform::Terraform() + else + { + if ( !pObj->Implements(ObjectInterfaceType::Movable) ) continue; +- motion = dynamic_cast(pObj)->GetMotion(); ++ motion = dynamic_cast(*pObj).GetMotion(); + + dist = Math::Distance(m_terraPos, pObj->GetPosition()); + if ( dist > ACTION_RADIUS ) continue; +@@ -478,13 +478,13 @@ bool CTaskTerraform::Terraform() + if ( type == OBJECT_ANT || type == OBJECT_SPIDER ) + { + assert(pObj->Implements(ObjectInterfaceType::TaskExecutor)); +- dynamic_cast(pObj)->StopForegroundTask(); ++ dynamic_cast(*pObj).StopForegroundTask(); + + int actionType = -1; + if (type == OBJECT_ANT) actionType = MAS_BACK1; + if (type == OBJECT_SPIDER) actionType = MSS_BACK1; + motion->SetAction(actionType, 0.8f+Math::Rand()*0.3f); +- dynamic_cast(pObj)->SetFixed(true); // not moving ++ dynamic_cast(*pObj).SetFixed(true); // not moving + + if ( dist > 5.0f ) continue; + m_engine->GetPyroManager()->Create(Gfx::PT_EXPLOO, pObj); +diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp +index b97742c..112b982 100644 +--- a/src/physics/physics.cpp ++++ b/src/physics/physics.cpp +@@ -804,7 +804,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime) + + if (m_object->Implements(ObjectInterfaceType::Powered)) + { +- power = dynamic_cast(dynamic_cast(m_object)->GetPower()); // searches for the object battery uses ++ power = dynamic_cast(dynamic_cast(*m_object).GetPower()); // searches for the object battery uses + if ( GetObjectEnergy(m_object) == 0.0f ) // no battery or flat? + { + motorSpeed.x = 0.0f; +@@ -822,7 +822,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime) + } + } + +- if ( m_object->GetType() == OBJECT_HUMAN && dynamic_cast(m_object)->GetDying() == DeathType::Dead ) // dead man? ++ if ( m_object->GetType() == OBJECT_HUMAN && dynamic_cast(*m_object).GetDying() == DeathType::Dead ) // dead man? + { + motorSpeed.x = 0.0f; + motorSpeed.z = 0.0f; +@@ -852,7 +852,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime) + } + + if ( m_object->Implements(ObjectInterfaceType::JetFlying) && +- dynamic_cast(m_object)->GetRange() > 0.0f ) // limited flight range? ++ dynamic_cast(*m_object).GetRange() > 0.0f ) // limited flight range? + { + CJetFlyingObject* jetFlying = dynamic_cast(m_object); + if ( m_bLand || m_bSwim || m_bObstacle ) // on the ground or in the water? +@@ -960,7 +960,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime) + bool reactorCool = true; + if ( m_object->Implements(ObjectInterfaceType::JetFlying) ) + { +- reactorCool = dynamic_cast(m_object)->GetReactorRange() > 0.1f; ++ reactorCool = dynamic_cast(*m_object).GetReactorRange() > 0.1f; + } + if ( motorSpeed.y > 0.0f && reactorCool && pos.y < h ) + { +@@ -1459,7 +1459,7 @@ bool CPhysics::EventFrame(const Event &event) + iAngle = angle = m_object->GetRotation(); + + // Accelerate is the descent, brake is the ascent. +- if ( m_bFreeze || (m_object->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(m_object)->IsDying()) ) ++ if ( m_bFreeze || (m_object->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(*m_object).IsDying()) ) + { + m_linMotion.terrainSpeed.x = 0.0f; + m_linMotion.terrainSpeed.z = 0.0f; +@@ -1614,8 +1614,8 @@ void CPhysics::SoundMotor(float rTime) + else if ( type == OBJECT_ANT ) + { + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); +- if ( dynamic_cast(m_object)->GetDying() == DeathType::Burning || +- dynamic_cast(m_object)->GetFixed() ) ++ if ( dynamic_cast(*m_object).GetDying() == DeathType::Burning || ++ dynamic_cast(*m_object).GetFixed() ) + { + if ( m_lastSoundInsect <= 0.0f ) + { +@@ -1678,8 +1678,8 @@ void CPhysics::SoundMotor(float rTime) + else if ( type == OBJECT_SPIDER ) + { + assert(m_object->Implements(ObjectInterfaceType::Destroyable)); +- if ( dynamic_cast(m_object)->GetDying() == DeathType::Burning || +- dynamic_cast(m_object)->GetFixed() ) ++ if ( dynamic_cast(*m_object).GetDying() == DeathType::Burning || ++ dynamic_cast(*m_object).GetFixed() ) + { + if ( m_lastSoundInsect <= 0.0f ) + { +@@ -2501,7 +2501,7 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle) + { + if ( pObj == m_object ) continue; // yourself? + if (IsObjectBeingTransported(pObj)) continue; +- if ( pObj->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(pObj)->IsDying() ) continue; // is burning or exploding? ++ if ( pObj->Implements(ObjectInterfaceType::Destroyable) && dynamic_cast(*pObj).IsDying() ) continue; // is burning or exploding? + + oType = pObj->GetType(); + if ( oType == OBJECT_TOTO ) continue; +@@ -2603,7 +2603,7 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle) + + CPhysics* ph = nullptr; + if (pObj->Implements(ObjectInterfaceType::Movable)) +- ph = dynamic_cast(pObj)->GetPhysics(); ++ ph = dynamic_cast(*pObj).GetPhysics(); + if ( ph != nullptr ) + { + oAngle = pObj->GetRotation(); +@@ -2703,7 +2703,7 @@ bool CPhysics::ExploOther(ObjectType iType, + if ( force > destructionForce && destructionForce >= 0.0f ) + { + // TODO: implement "killer"? +- dynamic_cast(pObj)->DamageObject(damageType); ++ dynamic_cast(*pObj).DamageObject(damageType); + } + } + +@@ -2729,7 +2729,7 @@ bool CPhysics::ExploOther(ObjectType iType, + { + assert(pObj->Implements(ObjectInterfaceType::Damageable)); + // TODO: implement "killer"? +- dynamic_cast(pObj)->DamageObject(DamageType::Collision, force/400.0f); ++ dynamic_cast(*pObj).DamageObject(DamageType::Collision, force/400.0f); + } + + if (oType == OBJECT_MOBILEwa || +@@ -2760,7 +2760,7 @@ bool CPhysics::ExploOther(ObjectType iType, + { + assert(pObj->Implements(ObjectInterfaceType::Damageable)); + // TODO: implement "killer"? +- dynamic_cast(pObj)->DamageObject(DamageType::Collision, force/200.0f); ++ dynamic_cast(*pObj).DamageObject(DamageType::Collision, force/200.0f); + } + } + +@@ -2786,7 +2786,7 @@ int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force) + if ( force > destructionForce && destructionForce >= 0.0f ) + { + // TODO: implement "killer"? +- dynamic_cast(m_object)->DamageObject(DamageType::Explosive); ++ dynamic_cast(*m_object).DamageObject(DamageType::Explosive); + return 2; + } + +@@ -2867,7 +2867,7 @@ int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force) + } + + // TODO: implement "killer"? +- if ( dynamic_cast(m_object)->DamageObject(DamageType::Collision, force) ) return 2; ++ if ( dynamic_cast(*m_object).DamageObject(DamageType::Collision, force) ) return 2; + } + } + +@@ -2919,9 +2919,9 @@ void CPhysics::PowerParticle(float factor, bool bBreak) + bCarryPower = false; + if (m_object->Implements(ObjectInterfaceType::Carrier)) + { +- CObject* cargo = dynamic_cast(m_object)->GetCargo(); ++ CObject* cargo = dynamic_cast(*m_object).GetCargo(); + if ( cargo != nullptr && cargo->Implements(ObjectInterfaceType::PowerContainer) && +- dynamic_cast(cargo)->IsRechargeable() && ++ dynamic_cast(*cargo).IsRechargeable() && + m_object->GetPartRotationZ(1) == ARM_STOCK_ANGLE1 ) + { + bCarryPower = true; // carries a battery +@@ -3209,7 +3209,7 @@ void CPhysics::MotorParticle(float aTime, float rTime) + } + else // in flight? + { +- if ( !m_bMotor || (m_object->Implements(ObjectInterfaceType::JetFlying) && dynamic_cast(m_object)->GetReactorRange() == 0.0f) ) return; ++ if ( !m_bMotor || (m_object->Implements(ObjectInterfaceType::JetFlying) && dynamic_cast(*m_object).GetReactorRange() == 0.0f) ) return; + + if ( m_reactorTemperature < 1.0f ) // not too hot? + { +@@ -3339,7 +3339,7 @@ void CPhysics::MotorParticle(float aTime, float rTime) + } + else // in flight? + { +- if ( !m_bMotor || (m_object->Implements(ObjectInterfaceType::JetFlying) && dynamic_cast(m_object)->GetReactorRange() == 0.0f) ) return; ++ if ( !m_bMotor || (m_object->Implements(ObjectInterfaceType::JetFlying) && dynamic_cast(*m_object).GetReactorRange() == 0.0f) ) return; + + if ( aTime-m_lastMotorParticle < m_engine->ParticleAdapt(0.02f) ) return; + m_lastMotorParticle = aTime; +@@ -3400,7 +3400,7 @@ void CPhysics::MotorParticle(float aTime, float rTime) + + if ( (type == OBJECT_HUMAN || type == OBJECT_TECH) && m_bSwim ) + { +- if ( !m_object->Implements(ObjectInterfaceType::Destroyable) || dynamic_cast(m_object)->GetDying() != DeathType::Dead ) ++ if ( !m_object->Implements(ObjectInterfaceType::Destroyable) || dynamic_cast(*m_object).GetDying() != DeathType::Dead ) + { + h = Math::Mod(aTime, 5.0f); + if ( h < 3.5f && ( h < 1.5f || h > 1.6f ) ) return; +@@ -3722,7 +3722,7 @@ Error CPhysics::GetError() + + if (m_object->Implements(ObjectInterfaceType::ProgramStorage)) + { +- if ( dynamic_cast(m_object)->GetActiveVirus() ) ++ if ( dynamic_cast(*m_object).GetActiveVirus() ) + { + return ERR_VEH_VIRUS; + } +@@ -3730,14 +3730,14 @@ Error CPhysics::GetError() + + if (m_object->Implements(ObjectInterfaceType::Powered)) + { +- CObject* power = dynamic_cast(m_object)->GetPower(); // searches for the object battery used ++ CObject* power = dynamic_cast(*m_object).GetPower(); // searches for the object battery used + if (power == nullptr || !power->Implements(ObjectInterfaceType::PowerContainer)) + { + return ERR_VEH_POWER; + } + else + { +- if ( dynamic_cast(power)->GetEnergy() == 0.0f ) return ERR_VEH_ENERGY; ++ if ( dynamic_cast(*power).GetEnergy() == 0.0f ) return ERR_VEH_ENERGY; + } + } + +diff --git a/src/script/scriptfunc.cpp b/src/script/scriptfunc.cpp +index 0816cce..7bec6b5 100644 +--- a/src/script/scriptfunc.cpp ++++ b/src/script/scriptfunc.cpp +@@ -657,7 +657,7 @@ bool CScriptFunctions::rDelete(CBotVar* var, CBotVar* result, int& exception, vo + } + + CObject* obj = CObjectManager::GetInstancePointer()->GetObjectById(rank); +- if ( obj == nullptr || (obj->Implements(ObjectInterfaceType::Old) && dynamic_cast(obj)->IsDying()) ) ++ if ( obj == nullptr || (obj->Implements(ObjectInterfaceType::Old) && dynamic_cast(*obj).IsDying()) ) + { + return true; + } +@@ -665,7 +665,7 @@ bool CScriptFunctions::rDelete(CBotVar* var, CBotVar* result, int& exception, vo + { + if ( exploType != DestructionType::NoEffect && obj->Implements(ObjectInterfaceType::Destroyable) ) + { +- dynamic_cast(obj)->DestroyObject(static_cast(exploType)); ++ dynamic_cast(*obj).DestroyObject(static_cast(exploType)); + } + else + { +@@ -1434,7 +1434,7 @@ bool CScriptFunctions::rProduce(CBotVar* var, CBotVar* result, int& exception, v + CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_EGG); + if (object->Implements(ObjectInterfaceType::Programmable)) + { +- dynamic_cast(object)->SetActivity(false); ++ dynamic_cast(*object).SetActivity(false); + } + } + else +@@ -1452,7 +1452,7 @@ bool CScriptFunctions::rProduce(CBotVar* var, CBotVar* result, int& exception, v + if (type == OBJECT_MOBILEdr) + { + assert(object->Implements(ObjectInterfaceType::Old)); // TODO: temporary hack +- dynamic_cast(object)->SetManual(true); ++ dynamic_cast(*object).SetManual(true); + } + script->m_main->CreateShortcuts(); + } +@@ -1467,7 +1467,7 @@ bool CScriptFunctions::rProduce(CBotVar* var, CBotVar* result, int& exception, v + programStorage->ReadProgram(program, name2.c_str()); + program->readOnly = true; + program->filename = name; +- dynamic_cast(object)->RunProgram(program); ++ dynamic_cast(*object).RunProgram(program); + } + } + +@@ -2073,7 +2073,7 @@ bool CScriptFunctions::rReceive(CBotVar* var, CBotVar* result, int& exception, v + return true; + } + +- CExchangePost* exchangePost = dynamic_cast(script->m_taskExecutor->GetForegroundTask())->FindExchangePost(power); ++ CExchangePost* exchangePost = dynamic_cast(*script->m_taskExecutor->GetForegroundTask()).FindExchangePost(power); + script->m_returnValue = exchangePost->GetInfoValue(p); + } + if ( !WaitForForegroundTask(script, result, exception) ) return false; // not finished +@@ -2358,7 +2358,7 @@ bool CScriptFunctions::rShield(CBotVar* var, CBotVar* result, int& exception, vo + } + else // up ? + { +- dynamic_cast(pThis)->SetShieldRadius(radius); ++ dynamic_cast(*pThis).SetShieldRadius(radius); + err = script->m_taskExecutor->StartTaskShield(TSM_UP, 1000.0f); + if ( err != ERR_OK ) + { +@@ -2376,7 +2376,7 @@ bool CScriptFunctions::rShield(CBotVar* var, CBotVar* result, int& exception, vo + else // up? + { + //? result->SetValInt(1); // shows the error +- dynamic_cast(pThis)->SetShieldRadius(radius); ++ dynamic_cast(*pThis).SetShieldRadius(radius); + script->m_taskExecutor->StartTaskShield(TSM_UPDATE, 0.0f); + } + } +@@ -2550,7 +2550,7 @@ bool CScriptFunctions::rMotor(CBotVar* var, CBotVar* result, int& exception, voi + if ( turn < -1.0f ) turn = -1.0f; + if ( turn > 1.0f ) turn = 1.0f; + +- if ( dynamic_cast(pThis) != nullptr && dynamic_cast(pThis)->GetFixed() ) // ant on the back? ++ if ( dynamic_cast(pThis) != nullptr && dynamic_cast(*pThis).GetFixed() ) // ant on the back? + { + speed = 0.0f; + turn = 0.0f; +@@ -2659,7 +2659,7 @@ bool CScriptFunctions::rCmdline(CBotVar* var, CBotVar* result, int& exception, v + assert(pThis->Implements(ObjectInterfaceType::Programmable)); + + rank = var->GetValInt(); +- value = dynamic_cast(pThis)->GetCmdLine(rank); ++ value = dynamic_cast(*pThis).GetCmdLine(rank); + result->SetValFloat(value); + + return true; +diff --git a/src/ui/controls/map.cpp b/src/ui/controls/map.cpp +index 03cee9a..0ab5ea8 100644 +--- a/src/ui/controls/map.cpp ++++ b/src/ui/controls/map.cpp +@@ -1173,7 +1173,7 @@ void CMap::UpdateObject(CObject* pObj) + type != OBJECT_WORM && + type != OBJECT_MOBILEtg ) + { +- if (pObj->Implements(ObjectInterfaceType::Controllable) && !dynamic_cast(pObj)->GetSelectable()) return; ++ if (pObj->Implements(ObjectInterfaceType::Controllable) && !dynamic_cast(*pObj).GetSelectable()) return; + } + if ( pObj->GetProxyActivate() ) return; + if (IsObjectBeingTransported(pObj)) return; +@@ -1300,7 +1300,7 @@ void CMap::UpdateObject(CObject* pObj) + color != MAPCOLOR_MOVE ) return; + }*/ + +- if ( pObj->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(pObj)->GetSelect() ) ++ if ( pObj->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(*pObj).GetSelect() ) + { + m_map[MAPMAXOBJECT-1].type = type; + m_map[MAPMAXOBJECT-1].object = pObj; +diff --git a/src/ui/controls/target.cpp b/src/ui/controls/target.cpp +index e7b899b..e8729d7 100644 +--- a/src/ui/controls/target.cpp ++++ b/src/ui/controls/target.cpp +@@ -143,13 +143,13 @@ CObject* CTarget::DetectFriendObject(Math::Point pos) + CObject* target = obj; + if ( obj->Implements(ObjectInterfaceType::PowerContainer) && IsObjectBeingTransported(obj) ) + { +- target = dynamic_cast(obj)->GetTransporter(); ++ target = dynamic_cast(*obj).GetTransporter(); + } + + if ( !target->GetDetectable() ) continue; + if ( target->GetProxyActivate() ) continue; +- if ( target->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(target)->GetSelect() ) continue; +- if ( !target->Implements(ObjectInterfaceType::Controllable) || !dynamic_cast(target)->GetSelectable() ) continue; ++ if ( target->Implements(ObjectInterfaceType::Controllable) && dynamic_cast(*target).GetSelect() ) continue; ++ if ( !target->Implements(ObjectInterfaceType::Controllable) || !dynamic_cast(*target).GetSelectable() ) continue; + + if (!target->Implements(ObjectInterfaceType::Old)) continue; // TODO: To be removed after COldObjectInterface is gone + +diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp +index b1e6220..5d2bafb 100644 +--- a/src/ui/displayinfo.cpp ++++ b/src/ui/displayinfo.cpp +@@ -109,7 +109,7 @@ bool CDisplayInfo::EventProcess(const Event &event) + if ( m_toto != nullptr ) + { + assert(m_toto->Implements(ObjectInterfaceType::Movable)); +- CMotionToto* toto = static_cast(dynamic_cast(m_toto)->GetMotion()); ++ CMotionToto* toto = static_cast(dynamic_cast(*m_toto).GetMotion()); + assert(toto != nullptr); + toto->SetMousePos(event.mousePos); + } +@@ -449,7 +449,7 @@ void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluc + m_toto->SetDrawFront(true); + + assert(m_toto->Implements(ObjectInterfaceType::Movable)); +- CMotionToto* toto = static_cast(dynamic_cast(m_toto)->GetMotion()); ++ CMotionToto* toto = static_cast(dynamic_cast(*m_toto).GetMotion()); + assert(toto != nullptr); + toto->StartDisplayInfo(); + } +@@ -840,7 +840,7 @@ void CDisplayInfo::StopDisplayInfo() + if ( m_toto != nullptr ) + { + assert(m_toto->Implements(ObjectInterfaceType::Movable)); +- CMotionToto* toto = static_cast(dynamic_cast(m_toto)->GetMotion()); ++ CMotionToto* toto = static_cast(dynamic_cast(*m_toto).GetMotion()); + assert(toto != nullptr); + toto->StopDisplayInfo(); + } +diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp +index 6bd8dcf..51c82ba 100644 +--- a/src/ui/displaytext.cpp ++++ b/src/ui/displaytext.cpp +@@ -258,7 +258,7 @@ void CDisplayText::DisplayText(const char *text, Math::Vector goal, float height + if ( toto != nullptr ) + { + assert(toto->Implements(ObjectInterfaceType::Movable)); +- motion = dynamic_cast(toto)->GetMotion(); ++ motion = dynamic_cast(*toto).GetMotion(); + + if ( type == TT_ERROR ) + { +diff --git a/src/ui/mainshort.cpp b/src/ui/mainshort.cpp +index 9017ccd..5e061a9 100644 +--- a/src/ui/mainshort.cpp ++++ b/src/ui/mainshort.cpp +@@ -150,7 +150,7 @@ bool CMainShort::CreateShortcuts() + for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) + { + if ( !pObj->GetDetectable() ) continue; +- if ( pObj->Implements(ObjectInterfaceType::Controllable) && !dynamic_cast(pObj)->GetSelectable() ) continue; ++ if ( pObj->Implements(ObjectInterfaceType::Controllable) && !dynamic_cast(*pObj).GetSelectable() ) continue; + if ( pObj->GetProxyActivate() ) continue; + + int icon = GetShortcutIcon(pObj->GetType()); +@@ -245,9 +245,9 @@ bool CMainShort::UpdateShortcuts() + if ( pc != nullptr ) + { + assert(m_shortcuts[i]->Implements(ObjectInterfaceType::Controllable)); +- pc->SetState(STATE_CHECK, dynamic_cast(m_shortcuts[i])->GetSelect()); +- pc->SetState(STATE_RUN, m_shortcuts[i]->Implements(ObjectInterfaceType::Programmable) && dynamic_cast(m_shortcuts[i])->IsProgram()); +- pc->SetState(STATE_DAMAGE, dynamic_cast(m_shortcuts[i])->IsDamaging()); ++ pc->SetState(STATE_CHECK, dynamic_cast(*m_shortcuts[i]).GetSelect()); ++ pc->SetState(STATE_RUN, m_shortcuts[i]->Implements(ObjectInterfaceType::Programmable) && dynamic_cast(*m_shortcuts[i]).IsProgram()); ++ pc->SetState(STATE_DAMAGE, dynamic_cast(*m_shortcuts[i]).IsDamaging()); + } + } + return true; +diff --git a/src/ui/object_interface.cpp b/src/ui/object_interface.cpp +index ab1fb08..71d3ef2 100644 +--- a/src/ui/object_interface.cpp ++++ b/src/ui/object_interface.cpp +@@ -593,7 +593,7 @@ bool CObjectInterface::EventProcess(const Event &event) + ps = static_cast< CSlider* >(pw->SearchControl(EVENT_OBJECT_DIMSHIELD)); + if ( ps != nullptr ) + { +- dynamic_cast(m_object)->SetShieldRadius((ps->GetVisibleValue()-(RADIUS_SHIELD_MIN/g_unit))/((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit)); ++ dynamic_cast(*m_object).SetShieldRadius((ps->GetVisibleValue()-(RADIUS_SHIELD_MIN/g_unit))/((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit)); + } + } + } +@@ -1726,7 +1726,7 @@ void CObjectInterface::UpdateInterface() + ps = static_cast< CSlider* >(pw->SearchControl(EVENT_OBJECT_DIMSHIELD)); + if ( ps != nullptr ) + { +- ps->SetVisibleValue((RADIUS_SHIELD_MIN/g_unit)+dynamic_cast(m_object)->GetShieldRadius()*((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit)); ++ ps->SetVisibleValue((RADIUS_SHIELD_MIN/g_unit)+dynamic_cast(*m_object).GetShieldRadius()*((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit)); + } + } +