Jump to content
SSForum.net is back!

Recommended Posts

Posted

Well yeah, two days of straight debugging and I finally found this one. I think it surp!@#$%^&*es my previous favorite en!@#$%^&*led "pragma pack is the devil": http://forums.minegoboom.com/viewtopic.php?t=6508

 

anyways I was using an STL vector to store the ships which should be drawn on the screen. I then passed around pointers to these Ships to other modules so they could modify them as they see fit. The problem is, a vector reallocates memory as it grows... so when I had the pointer to the first element and then inserted another ship, the pointer to the first ship no longer pointed to valid memory. Rather than crashing, the program continued to run, until something else allocated some memory in the same spot (which happened to be an image that I wanted to draw), and then whenever I modified the ship I was also modifying the image. SDL then complained that images should be unlocked when drawing them to the screen (apparently the ships's y pixel location mapped to the locked field of the SDL_Surface structure)... so basically I had to work backwards from SDL's complaints to find the real problem.

 

anyways yeah just rambling... that's about 20 hours of my life I'll never get back!

Posted
ooh that's one nasty bug. I hate these bugs that seem random but are caused by some stupid stupid thing that's hidden like !@#$%^&* and involves LOTS of frustration and backtracking to find ....
Posted
Good example of why you should always just write everything correctly the first time and skip all of this nonsense

_UU___UU__SSSSS____AAA____UU___UU__SSSSS____AAA___

_UU___UU_SS_______AAAAA___UU___UU_SS_______AAAAA__

_UU___UU__SSSSS__AA___AA__UU___UU__SSSSS__AA___AA_

_UU___UU______SS_AAAAAAA__UU___UU______SS_AAAAAAA_

__UUUUU___SSSSS_AA____AA___UUUUU___SSSSS_AA____AA

J.C. Dento> prime example of why america will never be a world super power.

Moscato> d1 is mad he will never have a job outside subspace

I can't see this because I turned signatures off. ps VT

×
×
  • Create New...