quote:Original post by Anonymous PosterOriginal post by davepermen
just want to that you use new, but you''re not storing the pointer to the new allocated object anywhere. and you delete the object itself (delete this) in the end.. both is for 99% of the time stupid and can result in a crash..
What he did is perfectly fine.
#1 - The pointer is stored… in the object''s ''this'' variable.
#2 - ''delete this;'' is usually a perfectly valid thing to do, so long as you don''t try to use any member vars or functions after calling it.
i said 99%. he''s actually in the 1% where its okay, hehe:D
so, do it different.. do the simulation with particles, and generate new particles if the water splits.. add them in a list, vector, what ever, and go trough the whole array, to process each one. and again and again till the list is empty.. should work..
"take a look around" - limp bizkit
www.google.com