fix(streaming): commit EnvCell landblocks atomically (#214)
Carry one complete cell payload with each streaming completion and publish visibility, physics, and render state on the render thread. Remove the obsolete post-readiness login reload that triggered a duplicate dungeon build. Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
parent
85980fe13f
commit
b0c175afc0
26 changed files with 973 additions and 617 deletions
|
|
@ -0,0 +1,39 @@
|
|||
using AcDream.App.Rendering;
|
||||
|
||||
namespace AcDream.App.Tests.Rendering;
|
||||
|
||||
public class CellVisibilityCommitTests
|
||||
{
|
||||
[Fact]
|
||||
public void CommitLandblock_ReplacesOnlyThatLandblocksCompleteCellSet()
|
||||
{
|
||||
var visibility = new CellVisibility();
|
||||
visibility.CommitLandblock(0x8C04FFFFu, new[]
|
||||
{
|
||||
Cell(0x8C040100u),
|
||||
Cell(0x8C040101u),
|
||||
});
|
||||
visibility.CommitLandblock(0x0007FFFFu, new[] { Cell(0x00070100u) });
|
||||
|
||||
visibility.CommitLandblock(0x8C04FFFFu, new[] { Cell(0x8C040200u) });
|
||||
|
||||
Assert.False(visibility.TryGetCell(0x8C040100u, out _));
|
||||
Assert.False(visibility.TryGetCell(0x8C040101u, out _));
|
||||
Assert.True(visibility.TryGetCell(0x8C040200u, out _));
|
||||
Assert.True(visibility.TryGetCell(0x00070100u, out _));
|
||||
Assert.Single(visibility.GetCellsForLandblock(0x8C04u));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CommitLandblock_RejectsForeignCellBeforeChangingCurrentState()
|
||||
{
|
||||
var visibility = new CellVisibility();
|
||||
visibility.CommitLandblock(0x8C04FFFFu, new[] { Cell(0x8C040100u) });
|
||||
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
visibility.CommitLandblock(0x8C04FFFFu, new[] { Cell(0x00070100u) }));
|
||||
Assert.True(visibility.TryGetCell(0x8C040100u, out _));
|
||||
}
|
||||
|
||||
private static LoadedCell Cell(uint id) => new() { CellId = id };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue