From fa8e05d56d908d0eb654770685eb9b904152a99c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 25 Oct 2016 22:40:58 +0200 Subject: [PATCH] - do not allow a multipatch texture to use itself as patch. Instead, look for an older texture with the same name. --- src/textures/multipatchtexture.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 340376a25..cb2d5d803 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -1323,6 +1323,24 @@ void FMultiPatchTexture::ResolvePatches() for (int i = 0; i < NumParts; i++) { FTextureID texno = TexMan.CheckForTexture(Inits[i].TexName, Inits[i].UseType); + if (texno == id) // we found ourselves. Try looking for another one with the same name which is not a multipatch texture itself. + { + TArray list; + TexMan.ListTextures(Inits[i].TexName, list); + for (int i = list.Size() - 1; i >= 0; i--) + { + if (list[i] != id && !TexMan[list[i]]->bMultiPatch) + { + texno = list[i]; + break; + } + } + if (texno == id) + { + if (Inits[i].HasLine) Inits[i].sc.Message(MSG_WARNING, "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars()); + else Printf(TEXTCOLOR_YELLOW "Texture '%s' references itself as patch\n", Inits[i].TexName.GetChars()); + } + } if (!texno.isValid()) {