From: Patrik Gornicz Date: Thu, 11 Dec 2008 01:09:23 +0000 (-0500) Subject: optomized collisions to exclude half of the tests X-Git-Tag: v0.09~11 X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=commitdiff_plain;h=1a4f2f30e4582501500f448fb7b1f0b87f4094f9 optomized collisions to exclude half of the tests --- diff --git a/src/collisionManager.cpp b/src/collisionManager.cpp index 9db130e..5d2dff0 100644 --- a/src/collisionManager.cpp +++ b/src/collisionManager.cpp @@ -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); } } }