[ODE] dCloseODE() patch

David McClurg dmcclurg at pandemicstudios.com.au
Tue Aug 6 20:41:02 2002


I'm on a console and I want to get back to a pristine state between levels.  Since I have multiple ODE sessions I ran into a bug where the geom class vars weren't getting reset properly.  Here is the patch...

void dCloseODE()
{
  if (colliders) {
    delete colliders;
    colliders = 0;
  }
  if (classes) {
    for (int i=0; i < classes->size(); i++) {
      dFree ((*classes)[i], sizeof (dxGeomClass));
    }
    delete classes;
    classes = 0;
  }

  // reset geom class vars
  dSphereClass = -1;
  dBoxClass = -1;
  dCCylinderClass = -1;
  dPlaneClass = -1;
  dGeomGroupClass = -1;
  dGeomTransformClass = -1;

  // from contribs...
  dTriListClass = -1;
  dRayClass = -1;
}

Ta