SDLPP colidesWith: only add id once

Before this change collision id was added for every collision it was a
part of, but we only want that id once (the collider collided, that's all
that matters)
This commit is contained in:
zvon 2021-05-27 18:08:48 +02:00
parent 757a03568d
commit db338fd544

View File

@ -55,8 +55,10 @@ RenderObject::colidesWith( const RenderObject &other ) const {
std::vector< uint64_t > ret = {}; std::vector< uint64_t > ret = {};
for ( const auto &x : collisions ) { for ( const auto &x : collisions ) {
for ( const auto &y : other.getCollisions() ) { for ( const auto &y : other.getCollisions() ) {
if ( x->colidesWith( *y ) ) if ( x->colidesWith( *y ) ) {
ret.push_back( x->getId() ); ret.push_back( x->getId() );
break;
}
} }
} }
return ret; return ret;