Пример #1
0
int dAllocateODEDataForThread(unsigned int uiAllocateFlags)
{
	dIASSERT(g_bODEInitialized); // Call dInitODEEx first

	bool bResult = false;
	
	bool bCollisionDataAllocated = false;

	do
	{
		if (!AllocateThreadBasicDataIfNecessary())
		{
			break;
		}

		if (uiAllocateFlags & dAllocateFlagCollisionData)
		{
			if (!AllocateThreadCollisionDataIfNecessary(bCollisionDataAllocated))
			{
				break;
			}
		}
	
		bResult = true;
	}
	while (false);

	if (!bResult)
	{
		if (bCollisionDataAllocated)
		{
			FreeThreadCollisionData();
		}

		FreeThreadBasicDataOnFailureIfNecessary();
	}
	
	return bResult;
}
Пример #2
0
static bool AllocateODEDataForThreadForMode(EODEINITMODE imInitMode, unsigned int uiAllocateFlags)
{
    bool bResult = false;

    bool bCollisionDataAllocated = false;

    do
    {
        if (!AllocateThreadBasicDataIfNecessary(imInitMode))
        {
            break;
        }

        if (uiAllocateFlags & dAllocateFlagCollisionData)
        {
            if (!AllocateThreadCollisionDataIfNecessary(imInitMode, bCollisionDataAllocated))
            {
                break;
            }
        }

        bResult = true;
    }
    while (false);

    if (!bResult)
    {
        if (bCollisionDataAllocated)
        {
            FreeThreadCollisionData(imInitMode);
        }

        FreeThreadBasicDataOnFailureIfNecessary(imInitMode);
    }

    return bResult;
}