Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
67 lines
1.4 KiB
C++
67 lines
1.4 KiB
C++
// TextureContainer.cpp: implementation of the CTextureContainer class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "TextureContainer.h"
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CTextureContainer::CTextureContainer()
|
|
{
|
|
|
|
}
|
|
|
|
CTextureContainer::~CTextureContainer()
|
|
{
|
|
DeleteAllTexture();
|
|
}
|
|
|
|
void CTextureContainer::AddTexture(const char *strTextName, const LPDIRECT3DBASETEXTURE8 pddTexture)
|
|
{
|
|
m_TextureList.Add(new TextureNode(strTextName,pddTexture));
|
|
}
|
|
|
|
int CTextureContainer::FindTexture(char *strTextName)
|
|
{
|
|
for(int i=0;i<m_TextureList.num;i++)
|
|
{
|
|
if(strcmp(m_TextureList[i]->m_strTextureName,strTextName)==0)
|
|
return i;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
LPDIRECT3DBASETEXTURE8 CTextureContainer::AddUsedTexture(int nUsed)
|
|
{
|
|
m_TextureList[nUsed]->m_nUsed++;
|
|
return m_TextureList[nUsed]->m_pddsTexture;
|
|
}
|
|
|
|
void CTextureContainer::DeleteTexture(char *strTextName)
|
|
{
|
|
for(int i=0;i<m_TextureList.num;i++)
|
|
{
|
|
if(strcmp(m_TextureList[i]->m_strTextureName,strTextName)==0)
|
|
{
|
|
if(--m_TextureList[i]->m_nUsed==0)
|
|
{
|
|
TextureNode *temp=m_TextureList[i];
|
|
m_TextureList.DelIndex(i);
|
|
delete temp;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void CTextureContainer::DeleteAllTexture()
|
|
{
|
|
for(int i=0;i<m_TextureList.num;i++)
|
|
{
|
|
delete m_TextureList[i];
|
|
}
|
|
m_TextureList.num=0;
|
|
}
|