]> Shamusworld >> Repos - architektonas/blobdiff - src/container.cpp
Preliminary Delete Object tool implementation.
[architektonas] / src / container.cpp
index 727c14360450cc498cf809b119bb08f3967021fb..4fceefdac106829e6d0a939f5e89fc27b66f437e 100644 (file)
@@ -101,14 +101,30 @@ Like so:
 #else
        bool collision = false;
 
-       for(int i=0; i<(int)objects.size(); i++)
+       // NOTE that this deletes the object on mouse down instead of mouse up. Have to
+       // check to see how it feels to do it that way...
+       if (deleteActive)
+       {
+               for(int i=0; i<(int)objects.size(); i++)
+               {
+                       if (objects[i]->Collided(point))
+                       {
+                               objects.erase(objects.begin() + i);     // Calls the destructor, (deletes the object, I presume... O_o)
+                               break;
+                       }
+               }
+       }
+       else
        {
-               if (objects[i]->Collided(point))
-                       collision = true;
+               for(int i=0; i<(int)objects.size(); i++)
+               {
+                       if (objects[i]->Collided(point))
+                               collision = true;
+               }
        }
 #endif
 
-       // Do we decouple the state of the generic container from the objects inside???
+       // Do we decouple the state of the generic container from the objects inside??? Mebbe.
        state = OSInactive;
 //     return false;
        return collision;