Fixed some issues with asset name generation in MP3/DKCR and fixed a memory leak in the character editor

This commit is contained in:
Aruki
2017-07-08 13:38:03 -06:00
parent 21efd3999f
commit cbdebd2f7e
10 changed files with 20917 additions and 20892 deletions

View File

@@ -65,8 +65,11 @@ void ApplyGeneratedName(CResourceEntry *pEntry, const TString& rkDir, const TStr
NewName = SanitizedName;
int AppendNum = 0;
while (pNewDir->FindChildResource(NewName, pEntry->ResourceType()) != nullptr)
while (CResourceEntry *pConflict = pNewDir->FindChildResource(NewName, pEntry->ResourceType()))
{
if (pConflict == pEntry)
return;
NewName = TString::Format("%s_%d", *SanitizedName, AppendNum);
AppendNum++;
}
@@ -95,8 +98,12 @@ void GenerateAssetNames(CGameProject *pProj)
bool HasCustomName = !It->HasFlag(eREF_AutoResName);
if (HasCustomDir && HasCustomName) continue;
TString NewDir = (HasCustomDir ? It->DirectoryPath() : "Uncategorized/");
TString NewDir = (HasCustomDir ? It->DirectoryPath() : pStore->DefaultResourceDirPath());
TString NewName = (HasCustomName ? It->Name() : It->ID().ToString());
if (!HasCustomDir && pProj->Game() >= eCorruptionProto)
NewDir = NewDir.ToLower();
It->Move(NewDir, NewName, true, true);
}
#endif