Well I wrote this nifty little function for my object loading...
int dbLoadObjectEx ( std::string fileName ) {
int objId = 0;
for ( int i = 1; i < 10000; i++ ) { if ( !dbObjectExist(i) ) objId = i; }
if ( objId == 0 ) {
MessageBox(NULL,"@ main::dbLoadObjectEx() no free id!","Fatal Error!",MB_OK);
} else {
dbLoadObject( const_cast<char*>(fileName.c_str()), objId );
if ( !dbObjectExist( objId ) ) {
MessageBox(NULL,"@ main::dbLoadObjectEx() load fail!","Fatal Error!",MB_OK);
} else {
return objId;
} //end if
} //end if
return 0;
} //end dbLoadObjectEx
It will auto find a available media id, load the file, and then return the media id. If there are no free media ids, or the file has trouble loading, you get a little warning box and the return value is 0 (so it shouldnt screw up anything if you try and position the object, ect...).
Now I gotta make one of these for images, meshes, ect... I got my night planned!
*edit and btw, I tryed loading a 'bad' file for my terrain objects, just to see what would happen, and everything seemed to run just fine! The terrain object didnt display obviously, but because my 'super happy Ex' function returned a media id of 0, things didnt crash, even when doing about everything under the sun to a '0' object (positioning, hiding limbs, texturing, manipulating all the vertex data, ect).
All you need is zeal