[REQ] NewtonDestroyBody must check

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

[REQ] NewtonDestroyBody must check

Postby AntonSynytsia » Mon Mar 10, 2014 3:55 am

It would be nice to have newton check whether the body_ptr is not deleted prior to destroying the body. That way you will avoid crashes under certain circumstances that the developer might come across.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: [REQ] NewtonDestroyBody must check

Postby AntonSynytsia » Mon Mar 10, 2014 4:02 am

Or perhaps create the checking functions:

NewtonBodyValid(body_ptr) - returns 1 (valid) or 0 (invalid)

~ and some more to remain consistent.

NewtonCollisionValid
NewtonWorldValid
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: [REQ] NewtonDestroyBody must check

Postby Julio Jerez » Mon Mar 10, 2014 10:09 am

you can do that yourself
the body have a destructor function pointer.

all you have to do when you create a body is place each body in a map, and assign the destructor callback.
the detrusor callback is called by the engine body when the body is about to be deleted, you simple remove it for the map
then NewtonBodyValid(body_ptr) simple check if the point is in the map
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [REQ] NewtonDestroyBody must check

Postby AntonSynytsia » Mon Mar 10, 2014 11:57 am

handling bodies via the destructor callback is perhaps not a bad idea. Thanks!
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 4 guests