From c1d2b548208a1c384c2f9e52432915ce1dc53b2a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 28 Jan 2018 11:51:39 +0100 Subject: [PATCH] - let TexMan.GetName return the actual name for a texture that was created from a full path name. --- src/textures/texturemanager.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 5039f48b6..613aa3be9 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -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); } //==========================================================================