Add exception tolerance to explosion processing (#9309)
This commit is contained in:
@@ -117,12 +117,25 @@ public sealed partial class ExplosionSystem : EntitySystem
|
|||||||
// TODO EXPLOSION check if active explosion is on a paused map. If it is... I guess support swapping out &
|
// TODO EXPLOSION check if active explosion is on a paused map. If it is... I guess support swapping out &
|
||||||
// storing the "currently active" explosion?
|
// storing the "currently active" explosion?
|
||||||
|
|
||||||
var processed = _activeExplosion.Process(tilesRemaining);
|
#if EXCEPTION_TOLERANCE
|
||||||
tilesRemaining -= processed;
|
try
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
var processed = _activeExplosion.Process(tilesRemaining);
|
||||||
|
tilesRemaining -= processed;
|
||||||
|
|
||||||
// has the explosion finished processing?
|
// has the explosion finished processing?
|
||||||
if (_activeExplosion.FinishedProcessing)
|
if (_activeExplosion.FinishedProcessing)
|
||||||
|
_activeExplosion = null;
|
||||||
|
#if EXCEPTION_TOLERANCE
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// Ensure the system does not get stuck in an error-loop.
|
||||||
_activeExplosion = null;
|
_activeExplosion = null;
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.InfoS("Explosion", $"Processed {TilesPerTick - tilesRemaining} tiles in {Stopwatch.Elapsed.TotalMilliseconds}ms");
|
Logger.InfoS("Explosion", $"Processed {TilesPerTick - tilesRemaining} tiles in {Stopwatch.Elapsed.TotalMilliseconds}ms");
|
||||||
|
|||||||
Reference in New Issue
Block a user