From db338fd5440fa2c3efc4576ad558092f6641288c Mon Sep 17 00:00:00 2001 From: zvon Date: Thu, 27 May 2021 18:08:48 +0200 Subject: [PATCH] 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) --- sdlpp/sdlpp_renderobject.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdlpp/sdlpp_renderobject.cpp b/sdlpp/sdlpp_renderobject.cpp index 0058891..4cd1d5c 100644 --- a/sdlpp/sdlpp_renderobject.cpp +++ b/sdlpp/sdlpp_renderobject.cpp @@ -55,8 +55,10 @@ RenderObject::colidesWith( const RenderObject &other ) const { std::vector< uint64_t > ret = {}; for ( const auto &x : collisions ) { for ( const auto &y : other.getCollisions() ) { - if ( x->colidesWith( *y ) ) + if ( x->colidesWith( *y ) ) { ret.push_back( x->getId() ); + break; + } } } return ret;