szmate1618 / comets

1 stars 0 forks source link

GetBoundingBox returns reference to local #70

Closed szmate1618 closed 5 years ago

szmate1618 commented 5 years ago

The current implementation of collision detection does not actually handle bounding boxes, only a dummy implementation is provided, like: return { -10000, 10000, -10000, 10000 }; Which is problematic, because the method returns the result by const reference: virtual const geo::EmptyFrame& GetBoundingBox() = 0; But it's never passed to a const reference variable to extend its lifetime. This happens to not cause any problems in debug builds, but it does with -O2 optimization level, and results in polygon collisions being undetectable.