Unfortunaly the code is just too much to just paste, and I can't release the whole code either. But I will try to explain my problem.
First, I start the OBJECT_MANAGER
The Initiate() function loads the objects from a file and puts them in a temporary structure which basically holds a property name and value for every object. Then then from that info, the OBJECTs are created.
OBJECT_MANAGER::StaticInstance()->Initiate(); // The StaticInstance is to avoid making copies, only one OBJECT_MANAGER in the whole program.
Ok, now on the LoadFile
for (i = 0; i < num_objects; ++i)
OBJECT * newObject=new OBJECT;
newObject->origin = object_vec3(i, "origin"); // Position of the object.
newObject->angle = object_float(i, "angle"); // Angle faced by the object.
const char *objectclass_val = object_value(i, "classname"); // Determine what type of object it is.
if (!stricmp(objectclass_val, "sound")) // if it is a sound file
newObject->filename = object_value(i, "filename");
if (strcmp(newObject->filename, "") != 0)
newObject->SoundManager = new SOUND_MANAGER;
newObject->SoundManager->SoundData = SOUND_MANAGER::StaticInstance()->LoadFile(newObject->filename);
// Then other object_classes are processed.
Now, I have destructors for all my classes. For example the constructor and destructor for OBJECT look something like this
SOUND * newSound;
if( strncmp(filename+filenameLength-3, "MP3", 3)==0 || strncmp(filename+filenameLength-3, "mp3", 3)==0)
else if(strncmp(filename+filenameLength-3, "OGG", 3)==0 || strncmp(filename+filenameLength-3, "ogg", 3)==0)
The problem that it doesn't even get called, which means that none of the other classes inside SoundManager will get called either.
OBJECT() : SoundManager(NULL)
How can I fix that? THANKS!
PS: Don't worry for errors or if it compiles or not, I just made a quick example to explain, its not the actual code.