Follow-up Comment #2, bug #7075 (project wormux):

This patch do the job :

Index: src/object/physical_obj.cpp
===================================================================
--- src/object/physical_obj.cpp (révision 1256)
+++ src/object/physical_obj.cpp (copie de travail)
@@ -589,7 +589,7 @@
   return (y_max <= y);
 }

-bool PhysicalObj::IsOverlapping(PhysicalObj* obj) const
+bool PhysicalObj::IsOverlapping(const PhysicalObj* obj) const
 {
   return m_overlapping_object == obj;
 }
@@ -633,7 +633,7 @@
     {
       FOR_ALL_LIVING_CHARACTERS(team,character)
       {
-        if (&(*character) != this && !IsOverlapping(&(*character))
+        if (&(*character) != this && (!IsOverlapping(&(*character)) ||
!character->IsOverlapping(this))
         && character->GetTestRect().Intersect( rect ))
           return (PhysicalObj*) &(*character);
       }
@@ -643,7 +643,7 @@
     {
       FOR_EACH_OBJECT(object)
       {
-        if (object -> ptr != this && !IsOverlapping(object->ptr)
+        if (object -> ptr != this && (!IsOverlapping(object->ptr) ||
!object->ptr->IsOverlapping(this))
         && object->ptr->m_collides_with_objects
         && object->ptr->GetTestRect().Intersect( rect ) )
           return object->ptr;
Index: src/object/physical_obj.h
===================================================================
--- src/object/physical_obj.h   (révision 1256)
+++ src/object/physical_obj.h   (copie de travail)
@@ -121,7 +121,7 @@
                         bool collides_with_characters,
                         bool collides_with_objects);
   void SetOverlappingObject(PhysicalObj* obj);
-  virtual bool IsOverlapping(PhysicalObj* obj) const;
+  virtual bool IsOverlapping(const PhysicalObj* obj) const;

   bool IsInVacuumXY(const Point2i &position, bool check_objects = true)
const;
   bool IsInVacuum(const Point2i &offset, bool check_objects = true) const;
// Relative to current position


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?7075>

_______________________________________________
  Message posté via/par Gna!
  http://gna.org/


_______________________________________________
Wormux-gna mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-gna

Reply via email to