Same here, a project that is crashing randomly at the dbSync() but it seems to occur only after loading a object. Also sometimes crashes when loading a object. It seemed to work okay once everything was loaded.
I remember reading somewhere on these forums not the use automatic object number assigning and assign object numbers manually. I wrote code to do this (below) but now have the dbSync() problem after updating Blitz Terrain...
Back to the App Game Kit for me...
#include <vector>
vector <bool> bMeshArray;
vector <bool> bObjectArray;
int getfreemesh()
{
// Scan for Existing Free Slot
for (int a = 0; a < int(bMeshArray.size()); a++)
{
if (bMeshArray[a] == false)
{
bMeshArray[a] = true;
#ifdef Console_Debugging
cout << "MESH:" << a + 1 << endl;
#endif
return a + 1; // Add one because 0 is invalid
}
}
// If No Slot Is Free Make More
int iBegin = bMeshArray.size();
int iEnd = iBegin + 10;
bMeshArray.resize(iEnd);
for (int a = iBegin; a < iEnd; a++)
{
bMeshArray[a] = false;
}
bMeshArray[iBegin] = true;
#ifdef Console_Debugging
cout << "MESH:" << iBegin + 1 << endl;
#endif
return iBegin + 1; // Add one because 0 is invalid
}
int dbLoadMeshSafely(string Filename)
{
int iNewMesh = getfreemesh();
dbLoadMesh(Filename, iNewMesh); // Only Works with X type Files...
return iNewMesh;
}
int dbCreateMeshFromObjectSafely(int SourceObject)
{
int iNewMesh = getfreemesh();
dbCreateMeshFromObject(SourceObject, iNewMesh);
return iNewMesh;
}
void dbDeleteMeshSafely(int Mesh)
{
// 0 is Invalid Number
Mesh--;
if (Mesh >= 0 && Mesh < int(bMeshArray.size()))
{
bMeshArray[Mesh] = false;
// Add Code Here to Free Memory If Enough Meshes Are Deleted?
}
Mesh++;
#ifdef Console_Debugging
cout << "MESH DELETE:" << Mesh << endl;
#endif
dbDeleteMesh(Mesh);
}
int getfreeobject()
{
// Scan for Existing Free Slot
for (int a = 0; a < int(bObjectArray.size()); a++)
{
if (bObjectArray[a] == false)
{
bObjectArray[a] = true;
#ifdef Console_Debugging
cout << "OBJECT:" << a + 1 << endl;
#endif
return a + 1; // Add one because 0 is invalid
}
}
// If No Slot Is Free Make More
int iBegin = bObjectArray.size();
int iEnd = iBegin + 10;
bObjectArray.resize(iEnd);
for (int a = iBegin; a < iEnd; a++)
{
bObjectArray[a] = false;
}
bObjectArray[iBegin] = true;
#ifdef Console_Debugging
cout << "OBJECT:" << iBegin + 1 << endl;
#endif
return iBegin + 1; // Add one because 0 is invalid
}
int dbLoadObjectSafely(string Filename)
{
int iNewObject = getfreeobject();
dbLoadObject(Filename, 0, 1, iNewObject);
return iNewObject;
}
int dbCreateObjectSafely(int Mesh)
{
int iNewObject = getfreeobject();
dbCreateObject(Mesh, 0, iNewObject);
return iNewObject;
}
int dbCreateObjectPlaneSafely(float Width, float Height)
{
int iNewObject = getfreeobject();
dbCreateObjectPlane(Width, Height, 0, iNewObject);
return iNewObject;
}
int dbCreateObjectSphereSafely(float Size, int Rows, int Columns)
{
int iNewObject = getfreeobject();
dbCreateObjectSphere(Size, Rows, Columns, iNewObject);
return iNewObject;
}
int dbCreateObjectBoxSafely(float Width, float Height, float Depth)
{
int iNewObject = getfreeobject();
dbCreateObjectBox(Width, Height, Depth, iNewObject);
return iNewObject;
}
int dbCloneObjectSafely(int Source)
{
int iNewObject = getfreeobject();
dbCloneObject(Source, iNewObject, 0);
return iNewObject;
}
int dbDeleteObjectSafely(int Object)
{
Object--; // 0 is Invalid Number
if (Object >= 0 && Object < int(bObjectArray.size()))
{
bObjectArray[Object] = false;
// Add Code Here to Free Memory If Enough Objects Are Deleted?
}
Object++;
#ifdef Console_Debugging
cout << "OBJECT DELETE:" << Object << endl;
#endif
return dbDeleteObject(Object);
}
bool dbIsObjectSafely(int Object)
{
Object--; // 0 is Invalid Number
if (Object >= 0 && Object < int(bObjectArray.size()))
{
return bObjectArray[Object];
}
return false;
}