optomized collisions to exclude half of the tests
authorPatrik Gornicz <Gornicz.P@gmail.com>
Thu, 11 Dec 2008 01:09:23 +0000 (20:09 -0500)
committerPatrik Gornicz <Gornicz.P@gmail.com>
Thu, 11 Dec 2008 01:09:23 +0000 (20:09 -0500)
src/collisionManager.cpp

index 9db130e..5d2dff0 100644 (file)
@@ -142,10 +142,10 @@ void updateEntities()
                      it2 != divisions[x][y].end();
                      it2++ )
                 {
-                    if( *it1 != *it2 )
-                    {
-                        applyCollision(*it1, *it2);
-                    }
+                    if( *it1 == *it2 )
+                        break;
+
+                    applyCollision(*it1, *it2);
                 }
             }
         }