- fixed: aliases for null textures must still be set.

Also added 'listtexturealiases' CCMD for debugging.
This commit is contained in:
Christoph Oelckers 2022-12-08 11:35:21 +01:00
parent 786c335489
commit 2b7e094019
2 changed files with 27 additions and 1 deletions

View file

@ -1604,10 +1604,31 @@ void FTextureManager::SetTranslation(FTextureID fromtexnum, FTextureID totexnum)
void FTextureManager::AddAlias(const char* name, FGameTexture* tex)
{
FTextureID id = tex->GetID();
if (tex != Textures[id.GetIndex()].Texture || !tex->isValid()) return; // Whatever got passed in here was not valid, so ignore the alias.
if (tex != Textures[id.GetIndex()].Texture)// || !tex->isValid())
{
return; // Whatever got passed in here was not valid, so ignore the alias.
}
aliases.Insert(name, id.GetIndex());
}
void FTextureManager::Listaliases()
{
decltype(aliases)::Iterator it(aliases);
decltype(aliases)::Pair* pair;
TArray<FString> list;
while (it.NextPair(pair))
{
auto tex = GetGameTexture(pair->Value);
list.Push(FStringf("%s -> %s%s", pair->Key.GetChars(), tex ? tex->GetName().GetChars() : "(null)", ((tex && tex->GetUseType() == ETextureType::Null) ? ", null" : "")));
}
std::sort(list.begin(), list.end(), [](const FString& l, const FString& r) { return l.CompareNoCase(r) < 0; });
for (auto& s : list)
{
Printf("%s\n", s.GetChars());
}
}
//==========================================================================
//
// FTextureID::operator+
@ -1627,3 +1648,7 @@ CCMD(flushtextures)
TexMan.FlushAll();
}
CCMD(listtexturealiases)
{
TexMan.Listaliases();
}

View file

@ -76,6 +76,7 @@ public:
bool OkForLocalization(FTextureID texnum, const char *substitute, int locnum);
void FlushAll();
void Listaliases();
FTextureID GetFrontSkyLayer(FTextureID);
FTextureID GetRawTexture(FTextureID tex, bool dontlookup = false);
void SetRawTexture(FTextureID texid)