Fix #5: Cull any gamesys links/linkdata with concrete LinkIDs

This commit is contained in:
Jarrod Doyle 2024-12-23 19:36:28 +00:00
parent 045285f82d
commit 1b13d92b99
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 32 additions and 0 deletions

View File

@ -83,6 +83,22 @@ public class LinkChunk : IChunk, IMergable
public void Merge(IMergable other) public void Merge(IMergable other)
{ {
// !HACK: We always merge into gamesys so we can pre-trim garbage here
var count = links.Count;
for (var i = count - 1; i >= 0; i--)
{
var link = links[i];
if (link.linkId.IsConcrete())
{
links.RemoveAt(i);
}
}
if (links.Count != count)
{
Console.WriteLine($"Trimmed links: {count} -> {links.Count}");
}
links.AddRange(((LinkChunk)other).links); links.AddRange(((LinkChunk)other).links);
} }
} }
@ -133,6 +149,22 @@ public class LinkDataMetaProp : IChunk, IMergable
public void Merge(IMergable other) public void Merge(IMergable other)
{ {
// !HACK: We always merge into gamesys so we can pre-trim garbage here
var count = linkData.Count;
for (var i = count - 1; i >= 0; i--)
{
var link = linkData[i];
if (link.linkId.IsConcrete())
{
linkData.RemoveAt(i);
}
}
if (linkData.Count != count)
{
Console.WriteLine($"Trimmed link data: {count} -> {linkData.Count}");
}
linkData.AddRange(((LinkDataMetaProp)other).linkData); linkData.AddRange(((LinkDataMetaProp)other).linkData);
} }
} }