Fix CopyAllowancesFrom patch for CE Custom Ammo compatibility
Thanks to @Epicguru for spotting the erroneous patch
This commit is contained in:
@@ -254,12 +254,11 @@ public class WorkGiver_DoBillOptimization : ClassWithFishPatches
|
||||
|
||||
if (cachedSmallestList.Count != smallestFilter.allowedDefs.Count)
|
||||
{
|
||||
// Log.Warning($"Cached list count: {cachedSmallestList.Count}, actual filter list count: {
|
||||
// smallestFilter.allowedDefs.Count}. Forcing a refresh now to fix.");
|
||||
Log.Warning($"Cached list count: {cachedSmallestList.Count}, actual filter list count: {
|
||||
smallestFilter.allowedDefs.Count}. Forcing a refresh now to fix.");
|
||||
ThingFilterPatches.ForceSynchronizeCache(smallestFilter);
|
||||
// Log.Warning($"New cached list count: {cachedSmallestList.Count}, actual filter list count: {
|
||||
// smallestFilter.allowedDefs.Count}.");
|
||||
// didn't trigger in 1.3, but now does. Fuck
|
||||
Log.Warning($"New cached list count: {cachedSmallestList.Count}, actual filter list count: {
|
||||
smallestFilter.allowedDefs.Count}.");
|
||||
}
|
||||
|
||||
var smallestListCount = cachedSmallestList.Count;
|
||||
|
||||
@@ -101,8 +101,12 @@ public class ThingFilterPatches : ClassWithFishPatches
|
||||
= static () => default(ThingFilter)!.CopyAllowancesFrom(null);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Prefix(ThingFilter __instance)
|
||||
=> AllowedDefsListCache.GetAndCheck<AllowedDefsListCacheValue>(__instance).Defs.Clear();
|
||||
public static void Prefix(ThingFilter __instance, ThingFilter other)
|
||||
{
|
||||
var defs = AllowedDefsListCache.GetAndCheck<AllowedDefsListCacheValue>(__instance).Defs;
|
||||
defs.Clear();
|
||||
defs.AddRange(other.AllowedThingDefs);
|
||||
}
|
||||
}
|
||||
|
||||
public class SetAllow_Patch : FishPatch
|
||||
|
||||
Reference in New Issue
Block a user