- let TexMan.GetName return the actual name for a texture that was created from a full path name.

This commit is contained in:
Christoph Oelckers 2018-01-28 11:51:39 +01:00
parent 6003625721
commit c1d2b54820

View file

@ -1206,8 +1206,21 @@ DEFINE_ACTION_FUNCTION(_TexMan, GetName)
{
PARAM_PROLOGUE;
PARAM_INT(texid);
const FTexture* const tex = TexMan.ByIndex(texid);
ACTION_RETURN_STRING(nullptr == tex ? FString() : tex->Name);
auto tex = TexMan.ByIndex(texid);
FString retval;
if (tex != nullptr)
{
if (tex->Name.IsNotEmpty()) retval = tex->Name;
else
{
// Textures for full path names do not have their own name, they merely link to the source lump.
auto lump = tex->GetSourceLump();
if (Wads.GetLinkedTexture(lump) == tex)
retval = Wads.GetLumpFullName(lump);
}
}
ACTION_RETURN_STRING(retval);
}
//==========================================================================