[Solved] Unload vehicle

Dirso

31-12-2006 21:15:12

Hi,

How do i unload or destroy a vehicle created with this line of code:
_vehicle = dotOgreOdeLoader.loadVehicle (filename, carname);

Thanks a lot,
Dirso

Dirso

01-01-2007 03:27:27

Hi,

I'm working with game States and everytime I leave a game level to start another, I delete the world, and everytime I get and error when I try to delete a world that has some vehicles

The exception happens in this code:
<deque>
_Lockit _Lock(_LOCK_DEBUG);
const_iterator **_Pnext = (const_iterator **)&this->_Myfirstiter;
while (*_Pnext != 0)
if ((*_Pnext)->_Myoff < _Offlo || _Offhigh < (*_Pnext)->_Myoff)
_Pnext = (const_iterator **)&(*_Pnext)->_Mynextiter;
else
{ // orphan the iterator
(*_Pnext)->_Mycont = 0;
*_Pnext = (const_iterator *)(*_Pnext)->_Mynextiter;
}


Any ideas?

Happy New Year!
Dirso

Aiursrage2k

03-01-2007 03:13:43

I am guessing it doesnt like you destroying the world, as the world destructor has a function called dCloseODE.

Dirso

06-01-2007 14:29:48

Actually, It's OK destoying the World ( :) ), but If I have wny vehicles inside this world, my application crashes.
Unhandled exception at 0x00bb6bab (OgreOde_Core_d.dll) in USC.exe: 0xC0000005: Access violation reading location 0x0000004c. and I'm sent back to that part of code I post.

I DO hope someone can help me,
Dirso

tuan kuranes

12-01-2007 15:49:51

delete _vehicle; ?
It shouldn't be calling dCloseODE in world destroy is OgreOde bug. try to comment that line.

Try run application in debug mode to find where it crashes exacly. (line code.)

Dirso

12-01-2007 19:47:16

It crashed when I try to destroy the vehicle
delete _vehicle;

tuan kuranes

16-01-2007 15:56:35

In OgreOde demos it doesn't crash, so that may related to code in your application. (hit 'n' to change car in ogreode demos)

Dirso

16-01-2007 18:12:45

Thank you very much!!! You were right!! Again!!
I had put the "delete _vehicle" inside the VehiclePlayer destructor and When I called delete _vehiclePlayer it crached!
But now I created a "Close()" funciont for my vehiclePlayer and it calls "delete _vehicle" and the use is simple, I first call vehiclePlayer->Close() then I "delete vehiclePlayer"

Thanks a lot and Happy New Year!!
Dirso