feat(headless): share immutable gameplay content

This commit is contained in:
Erik 2026-07-27 09:00:48 +02:00
parent 12b500d383
commit 9569dadb57
25 changed files with 1031 additions and 429 deletions

View file

@ -45,7 +45,7 @@ public sealed class RuntimeDatCollection : IDatReaderWriter
{
private readonly DatCollection _raw;
private readonly DatCollectionAdapter _bounded;
private bool _disposed;
private int _disposeStage;
internal RuntimeDatCollection(DatCollection raw)
{
@ -95,11 +95,22 @@ public sealed class RuntimeDatCollection : IDatReaderWriter
public void Dispose()
{
if (_disposed)
return;
_disposed = true;
_bounded.Dispose();
_raw.Dispose();
while (_disposeStage < 2)
{
switch (_disposeStage)
{
case 0:
_bounded.Dispose();
_disposeStage++;
break;
case 1:
_raw.Dispose();
_disposeStage++;
break;
default:
throw new InvalidOperationException(
"Unknown DAT owner teardown stage.");
}
}
}
}