- changed FTextureManager::ReplaceTexture to only append the new texture instead of replacing the old one.

This should ensure that other references to the original will remain valid.
This commit is contained in:
Christoph Oelckers 2018-12-20 18:10:06 +01:00
parent e05cedfc0d
commit 120b950291
3 changed files with 5 additions and 13 deletions

View File

@ -138,7 +138,7 @@ FTexture::FTexture (const char *name, int lumpnum)
:
Scale(1,1), SourceLump(lumpnum),
UseType(ETextureType::Any), bNoDecals(false), bNoRemap0(false), bWorldPanning(false),
bMasked(true), bAlphaTexture(false), bHasCanvas(false), bWarped(0), bComplex(false), bMultiPatch(false), bKeepAround(false), bFullNameTexture(false),
bMasked(true), bAlphaTexture(false), bHasCanvas(false), bWarped(0), bComplex(false), bMultiPatch(false), bFullNameTexture(false),
Rotations(0xFFFF), SkyOffset(0), Width(0), Height(0)
{
bBrightmapChecked = false;

View File

@ -468,17 +468,10 @@ void FTextureManager::ReplaceTexture (FTextureID picnum, FTexture *newtexture, b
newtexture->Name = oldtexture->Name;
newtexture->UseType = oldtexture->UseType;
Textures[index].Texture = newtexture;
newtexture->id = oldtexture->id;
if (free && !oldtexture->bKeepAround)
{
delete oldtexture;
}
else
{
oldtexture->id.SetInvalid();
}
// Add the new texture at the end of the texture list and clear the old one's name to ensure it won't be found anymore
// We cannot actually replace it because it may be referenced by some other texture.
oldtexture->Name = "";
AddTexture(newtexture);
}
//==========================================================================

View File

@ -407,7 +407,6 @@ protected:
// fully composited before subjected to any kind of postprocessing instead of
// doing it per patch.
uint8_t bMultiPatch:2; // This is a multipatch texture (we really could use real type info for textures...)
uint8_t bKeepAround:1; // This texture was used as part of a multi-patch texture. Do not free it.
uint8_t bFullNameTexture : 1;
uint8_t bBrightmapChecked : 1; // Set to 1 if brightmap has been checked
uint8_t bGlowing : 1; // Texture glow color