Skip to content

Commit

Permalink
- let TexMan.GetName return the actual name for a texture that was cr…
Browse files Browse the repository at this point in the history
…eated from a full path name.
  • Loading branch information
coelckers committed Jan 28, 2018
1 parent 6003625 commit c1d2b54
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/textures/texturemanager.cpp
Expand Up @@ -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);
}

//==========================================================================
Expand Down

0 comments on commit c1d2b54

Please sign in to comment.