mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Stop recursion scanning if it runs too long (#481)
This commit is contained in:
commit
a974f354fd
@ -256,6 +256,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
foreach (var senderWarp in outerFogWarpVolume._senderWarps.ToList())
|
foreach (var senderWarp in outerFogWarpVolume._senderWarps.ToList())
|
||||||
{
|
{
|
||||||
var currentWarp = senderWarp;
|
var currentWarp = senderWarp;
|
||||||
|
var n = 0;
|
||||||
while (currentWarp.GetContainerWarpVolume() != null)
|
while (currentWarp.GetContainerWarpVolume() != null)
|
||||||
{
|
{
|
||||||
if (currentWarp.GetContainerWarpVolume() == outerFogWarpVolume && currentWarp != senderWarp) // game already fixes here to here recursion
|
if (currentWarp.GetContainerWarpVolume() == outerFogWarpVolume && currentWarp != senderWarp) // game already fixes here to here recursion
|
||||||
@ -264,6 +265,8 @@ namespace NewHorizons.Builder.Body
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
currentWarp = (InnerFogWarpVolume)currentWarp.GetContainerWarpVolume().GetLinkedFogWarpVolume();
|
currentWarp = (InnerFogWarpVolume)currentWarp.GetContainerWarpVolume().GetLinkedFogWarpVolume();
|
||||||
|
n++;
|
||||||
|
if (n > 100) break; // just in case it gets caught in something else's recursion or there's no outside exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user