- make FGameTexture a separate object owning an FTexture instead of merely using a type cast to access it.

This commit is contained in:
Christoph Oelckers 2020-04-16 19:34:56 +02:00
commit a81bb2a136
3 changed files with 95 additions and 85 deletions

View file

@ -148,8 +148,6 @@ FTexture::FTexture (const char *name, int lumpnum)
FTexture::~FTexture ()
{
FGameTexture *link = fileSystem.GetLinkedTexture(SourceLump);
if (link->GetTexture() == this) fileSystem.SetLinkedTexture(SourceLump, nullptr);
if (areas != nullptr) delete[] areas;
areas = nullptr;
@ -1084,9 +1082,16 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
}
FGameTexture::~FGameTexture()
{
FGameTexture* link = fileSystem.GetLinkedTexture(GetSourceLump());
if (link == this) fileSystem.SetLinkedTexture(GetSourceLump(), nullptr);
delete wrapped;
}
bool FGameTexture::isUserContent() const
{
int filenum = fileSystem.GetFileContainer(wrapped.GetSourceLump());
int filenum = fileSystem.GetFileContainer(wrapped->GetSourceLump());
return (filenum > fileSystem.GetMaxIwadNum());
}