40250 classic: G1 integrate W2 (§2.1 data-layer EntityStore + net_world visibility, §2.3/§2.4/§2.5)

Doc conflicts in CLIENT-GAP.md / CLIENT-GAP-FIX.md resolved by W0: keep both
增量 50 W1 + W2 change-log bullets and C.5 batch records.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yvAPqPivoY7vmBbzgqK4W
This commit is contained in:
shenlei
2026-09-02 16:08:59 +09:00
co-authored by Claude Sonnet 5
8 changed files with 599 additions and 52 deletions
+43
View File
@@ -1590,6 +1590,49 @@ int main() {
CHECK(despawn, "despawn change emitted");
}
// --- CLIENT-GAP §2.1: EntityStore is the data layer. A far entity is a full
// row here with a queued Spawn/dirty; no scene, no replay buffer. Scene-
// node visibility (CHAR_STAGE_VIEW_BOUND cull / re-show) is asserted by
// project/net_world_vis_test.gd, which drives net_world.gd directly. ---
{
EntityStore d;
d.set_now(0);
d.mut_spawn_main(1, 1, "hero", 0, 0, 0);
d.drain_changes();
// GC_CHARACTER_ADD far outside any view bound -> still a full data row.
d.mut_spawn(4242, 101, 2, "far-orc", 900000.0f, 0.0f, 0.0f, 0.0f, 300, 90);
const Entity *orc = d.get(4242);
CHECK(orc && orc->race == 101 && orc->attack_speed == 90 && orc->name == "far-orc",
"§2.1 data layer: far GC_CHARACTER_ADD populates the entity row");
{
auto ch = d.drain_changes();
bool spawn = false;
for (auto &c : ch) {
if (c.kind == EntityStore::ChangeKind::Spawn && c.vid == 4242) {
spawn = true;
}
}
CHECK(spawn, "§2.1 data layer: a Spawn change is queued for the far entity");
}
// GC_CHARACTER_UPDATE for that same VID updates the row in place.
d.mut_char_update(4242, nullptr, 40, 120, 7, -3, 1, 0);
orc = d.get(4242);
CHECK(orc && orc->attack_speed == 120 && orc->moving_speed == 40 && orc->guild == 7,
"§2.1 data layer: UPDATE mutates the existing row");
// Unknown VID: no create, no replay buffer, no size growth.
const size_t n_before = d.size();
d.mut_char_update(999999, nullptr, 10, 10, 0, 0, 0, 0);
d.mut_move(999999, 90.0f, 1, 5.0f, 5.0f, 200);
d.mut_mount(999999, 20101);
d.mut_char_info(999999, "ghost", nullptr, 1, 0, 5, 0, 0, 0);
d.mut_shop_sign(999999, "ghost shop");
CHECK(d.size() == n_before && d.get(999999) == nullptr,
"§2.1 data layer: mutators for an unknown VID never spawn or buffer");
}
// --- ClientVS22 loading reset: discard map-local state, retain no stale deltas ---
es.mut_spawn(99, 101, 1, "reset-me", 10, 20, 0, 0);
es.mut_ground_add(700, 27100, 12, 24, 0);