Try to fix game hang caused by shelf linking.

Fixing an infinite loop caused by unchecked cache invalidation.

Sometime when you link shelves, a storageGroup in cache will not null, but with no SpawnedMember.

If unchecked, it will cause groupsOfPriorityCount to decrease by -1, which is a infinite loop.

This fix will FixCache when a group have no member.
This commit is contained in:
Foxtr0t1337
2024-06-16 04:07:27 +08:00
parent 79e8b5f70d
commit f0c486edf4
@@ -291,6 +291,9 @@ public sealed class StoreUtilityPrepatches : ClassWithFishPrepatches
if (storageGroup != null) if (storageGroup != null)
{ {
otherGroupMembers = storageGroup.SpawnedMemberCount() - 1; otherGroupMembers = storageGroup.SpawnedMemberCount() - 1;
if (otherGroupMembers < 0)
goto FixCache;
Debug.VerifyStorageGroup(otherGroupMembers, listInPriorityOrder, i, storageGroup); Debug.VerifyStorageGroup(otherGroupMembers, listInPriorityOrder, i, storageGroup);
groupsOfPriorityCount -= otherGroupMembers; groupsOfPriorityCount -= otherGroupMembers;