Blame colobot-gcc11.patch

1b541e3
diff --git a/src/graphics/engine/camera.cpp b/src/graphics/engine/camera.cpp
1b541e3
index 461f46a..1244f7d 100644
1b541e3
--- a/src/graphics/engine/camera.cpp
1b541e3
+++ b/src/graphics/engine/camera.cpp
1b541e3
@@ -59,14 +59,14 @@ static void SetTransparency(CObject* obj, float value)
1b541e3
 
1b541e3
     if (obj->Implements(ObjectInterfaceType::Carrier))
1b541e3
     {
1b541e3
-        CObject* cargo = dynamic_cast<CCarrierObject*>(obj)->GetCargo();
1b541e3
+        CObject* cargo = dynamic_cast<CCarrierObject&>(*obj).GetCargo();
1b541e3
         if (cargo != nullptr)
1b541e3
             cargo->SetTransparency(value);
1b541e3
     }
1b541e3
 
1b541e3
     if (obj->Implements(ObjectInterfaceType::Powered))
1b541e3
     {
1b541e3
-        CObject* power = dynamic_cast<CPoweredObject*>(obj)->GetPower();
1b541e3
+        CObject* power = dynamic_cast<CPoweredObject&>(*obj).GetPower();
1b541e3
         if (power != nullptr)
1b541e3
             power->SetTransparency(value);
1b541e3
     }
1b541e3
@@ -1233,7 +1233,7 @@ bool CCamera::EventFrameBack(const Event &event)
1b541e3
 
1b541e3
         bool ground = true;
1b541e3
         if (m_cameraObj->Implements(ObjectInterfaceType::Movable))
1b541e3
-            ground = dynamic_cast<CMovableObject*>(m_cameraObj)->GetPhysics()->GetLand();
1b541e3
+            ground = dynamic_cast<CMovableObject&>(*m_cameraObj).GetPhysics()->GetLand();
1b541e3
         if ( ground )  // ground?
1b541e3
         {
1b541e3
             Math::Vector pos = lookatPt + (lookatPt - m_eyePt);
1b541e3
@@ -1326,7 +1326,7 @@ bool CCamera::EventFrameOnBoard(const Event &event)
1b541e3
     {
1b541e3
         assert(m_cameraObj->Implements(ObjectInterfaceType::Controllable));
1b541e3
         Math::Vector lookatPt, upVec;
1b541e3
-        dynamic_cast<CControllableObject*>(m_cameraObj)->AdjustCamera(m_eyePt, m_directionH, m_directionV, lookatPt, upVec, m_type);
1b541e3
+        dynamic_cast<CControllableObject&>(*m_cameraObj).AdjustCamera(m_eyePt, m_directionH, m_directionV, lookatPt, upVec, m_type);
1b541e3
         Math::Vector eye    = m_effectOffset * 0.3f + m_eyePt;
1b541e3
         Math::Vector lookat = m_effectOffset * 0.3f + lookatPt;
1b541e3
 
1b541e3
diff --git a/src/object/interface/carrier_object.h b/src/object/interface/carrier_object.h
1b541e3
index b534fd4..a8510b6 100644
1b541e3
--- a/src/object/interface/carrier_object.h
1b541e3
+++ b/src/object/interface/carrier_object.h
1b541e3
@@ -51,5 +51,5 @@ public:
1b541e3
 inline bool IsObjectCarryingCargo(CObject* obj)
1b541e3
 {
1b541e3
     return obj->Implements(ObjectInterfaceType::Carrier) &&
1b541e3
-           dynamic_cast<CCarrierObject*>(obj)->IsCarryingCargo();
1b541e3
+           dynamic_cast<CCarrierObject&>(*obj).IsCarryingCargo();
1b541e3
 }
1b541e3
diff --git a/src/object/interface/powered_object.h b/src/object/interface/powered_object.h
1b541e3
index 54b6dd1..1216eda 100644
1b541e3
--- a/src/object/interface/powered_object.h
1b541e3
+++ b/src/object/interface/powered_object.h
1b541e3
@@ -61,10 +61,10 @@ inline float GetObjectEnergy(CObject* object)
1b541e3
 
1b541e3
     if (object->Implements(ObjectInterfaceType::Powered))
1b541e3
     {
1b541e3
-        CObject* power = dynamic_cast<CPoweredObject*>(object)->GetPower();
1b541e3
+        CObject* power = dynamic_cast<CPoweredObject&>(*object).GetPower();
1b541e3
         if (power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer))
1b541e3
         {
1b541e3
-            energy = dynamic_cast<CPowerContainerObject*>(power)->GetEnergy();
1b541e3
+            energy = dynamic_cast<CPowerContainerObject&>(*power).GetEnergy();
1b541e3
         }
1b541e3
     }
1b541e3
 
1b541e3
@@ -77,10 +77,10 @@ inline float GetObjectEnergyLevel(CObject* object)
1b541e3
 
1b541e3
     if (object->Implements(ObjectInterfaceType::Powered))
1b541e3
     {
1b541e3
-        CObject* power = dynamic_cast<CPoweredObject*>(object)->GetPower();
1b541e3
+        CObject* power = dynamic_cast<CPoweredObject&>(*object).GetPower();
1b541e3
         if (power != nullptr && power->Implements(ObjectInterfaceType::PowerContainer))
1b541e3
         {
1b541e3
-            energy = dynamic_cast<CPowerContainerObject*>(power)->GetEnergyLevel();
1b541e3
+            energy = dynamic_cast<CPowerContainerObject&>(*power).GetEnergyLevel();
1b541e3
         }
1b541e3
     }
1b541e3
 
1b541e3
@@ -90,5 +90,5 @@ inline float GetObjectEnergyLevel(CObject* object)
1b541e3
 inline bool ObjectHasPowerCell(CObject* object)
1b541e3
 {
1b541e3
     return object->Implements(ObjectInterfaceType::Powered) &&
1b541e3
-           dynamic_cast<CPoweredObject*>(object)->GetPower() != nullptr;
1b541e3
+           dynamic_cast<CPoweredObject&>(*object).GetPower() != nullptr;
1b541e3
 }
1b541e3
diff --git a/src/object/interface/transportable_object.h b/src/object/interface/transportable_object.h
1b541e3
index 2d0f90f..1ad95d0 100644
1b541e3
--- a/src/object/interface/transportable_object.h
1b541e3
+++ b/src/object/interface/transportable_object.h
1b541e3
@@ -54,5 +54,5 @@ public:
1b541e3
 inline bool IsObjectBeingTransported(CObject* obj)
1b541e3
 {
1b541e3
     return obj->Implements(ObjectInterfaceType::Transportable) &&
1b541e3
-           dynamic_cast<CTransportableObject*>(obj)->IsBeingTransported();
1b541e3
+           dynamic_cast<CTransportableObject&>(*obj).IsBeingTransported();
1b541e3
 }