capta1nseal / 2D-gravity-sim

2D gravity simulation made with c++ and sdl2
GNU General Public License v3.0
1 stars 0 forks source link

Fix follow interacting with adding/removing attractors #16

Open capta1nseal opened 6 months ago

capta1nseal commented 6 months ago

Since the position the camera follows is just kept track of through a pointer to a memory location, it's inevitable that this gets screwed up by changing the size of the vector that contains that position. To fix this, give camera a pointer to a pointer, which points to a pointer in the simulation component, which will then be adjusted or set to null depending on how data is rearranged.