Esempio n. 1
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : *pPrefab - 
//-----------------------------------------------------------------------------
void CPrefab::AddMRU(CPrefab *pPrefab)
{
	if(!bCacheEnabled)
		return;

	POSITION p = MRU.Find(pPrefab);
	if(p)
	{
		// remove there and add to head
		MRU.RemoveAt(p);
	}
	else if(MRU.GetCount() == 5)
	{
		// uncache tail object
		p = MRU.GetTailPosition();
		if(p)	// might not be any yet
		{
			CPrefab *pUncache = MRU.GetAt(p);
			pUncache->FreeData();
			MRU.RemoveAt(p);
		}
	}

	// add to head
	MRU.AddHead(pPrefab);
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPrefab::FreeAllData()
{
	// free all prefab data memory
	POSITION p = PrefabList.GetHeadPosition();
	while(p)
	{
		CPrefab *pPrefab = PrefabList.GetNext(p);
		pPrefab->FreeData();
	}
}