1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 06:53:31 +08:00

smarter checker for empty planet

This commit is contained in:
2023-09-02 14:24:33 +08:00
parent 74142eeaeb
commit cd9a85c693

View File

@@ -244,6 +244,16 @@ public class PoolOptPatch : BaseUnityPlugin
private static bool OptimizePool<T>(GetId<T> getter, int initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
{
if (cursor <= 1) return false;
if (recycleCursor == pool.Length)
{
cursor = 1;
capacity = initCapacity;
pool = new T[initCapacity];
recycle = new int[initCapacity];
recycleCursor = 0;
Logger.LogDebug("Resetted pool to initial status");
return true;
}
var pos = cursor - 1;
while (pos > 0)
{