Exemple #1
0
bool CTextureManager::Release (CTexture* texP)
{
Check ();
if (!m_textures)
	return false;
#if DBG
CTexture* t;
for (t = m_textures; t; t = t->Next ())
	if (texP == t)
		break;
if (!t) {
	TextureError ();
	return false;
	}
#endif
m_nTextures--;
if (m_textures == texP) {
	m_textures = texP->Next ();
#if DBG
	if (!m_textures && m_nTextures)
		TextureError ();
#endif
	}
return true;
}
bool CTextureManager::Check (void)
{
	CTexture*	texP = m_textures;
	int			i = 0;

while (texP) {
	if (!texP->Check ()) {
		TextureError ();
		return false;
		}
	texP = texP->Next ();
	i++;
	}
if  (i != m_nTextures) {
	TextureError ();
	return false;
	}
return true;
}
void CTextureManager::Register (CTexture* texP)
{
Check ();
if (texP == dbgTexP)
	dbgTexP = dbgTexP;
#if DBG
CTexture* t;
for (t = m_textures; t; t = t->Next ())
	if (texP == t) {
		TextureError ();
		return;
		}
#endif
texP->Link (NULL, m_textures);
if (m_textures)
	m_textures->SetPrev (texP);
m_nTextures++;
m_textures = texP;
Check ();
}