Denser encounter: camera nodes, wider garrison, thicker walls

- Map: 6 new wall pillars/stubs + 4 new cover crates; all load-bearing
  fixtures (blast door, airlock, terminal, LOS/fog test lines) preserved
- Network: 4 -> 7 nodes, 3 -> 6 edges; new Camera node type (C_CAMERA)
  sees farther (FOG_CAM_R=6 vs FOG_NODE_R=3) and draws a dotted sight
  ring when online; fog radius is now a per-node sight field
- Garrison: 8 -> 12 units (room-1 patrol, server-room guard, corridor
  patrol, turret on the door approach)
- Fix link slot/edge index conflation in linkOnEdge(): out-of-order
  routes (e.g. JUNC-CAM1 in slot 1) shadowed JUNC-DOOR with a permanent
  LINKING... refusal; NetLink now carries its edge id
- Tests: unit/fog_camera_sees_farther, unit/link_slots_dont_shadow_edges
  (verified failing against the old code)
This commit is contained in:
Dejvino
2026-11-15 14:56:55 +01:00
parent 8534bdc0b2
commit a6ea66d646
3 changed files with 120 additions and 47 deletions
+35 -2
View File
@@ -125,6 +125,24 @@ TEST(unit/sever_cascades_downstream)
EXPECT(linkIdx(1) < 0);
}
// regression: link slots are not edge indices. Routing out-of-order edges
// (JUNC-CAM1 = edge 3 lands in slot 1) used to make linkOnEdge(JUNC-DOOR)
// see slot 1 active and refuse the door link with "LINKING..." forever.
TEST(unit/link_slots_dont_shadow_edges)
{
freshScenario();
tryLink(N_JUNC); stepTicks(LINK_TICKS); // edge 0 -> slot 0
tryLink(N_CAM1); stepTicks(LINK_TICKS); // edge 3 -> slot 1
tryLink(N_CAM3); stepTicks(LINK_TICKS); // edge 5 -> slot 2
tryLink(N_DOOR); // edge 1 must still route
EXPECT(linkIdx(1) >= 0);
stepTicks(LINK_TICKS);
EXPECT(nodeOnline[N_DOOR]);
EXPECT(!doorOpen);
tryLink(N_DOOR); // online DOOR toggles
EXPECT(doorOpen);
}
// --- trace / feedback / reinforcement ---------------------------------------
TEST(unit/ice_trace_feedback_reinforcement)
@@ -318,6 +336,21 @@ TEST(unit/fog_online_nodes_uncover_connected_tiles)
EXPECT(fogSeenAt(18, 6)); // historical (grayscale) memory
}
// cameras see farther than plain nodes: FOG_CAM_R=6 vs FOG_NODE_R=3.
// CAM1 sits at (14,2) behind JUNC; its online reveal must reach 6 tiles
// down the open col-14 corridor but no farther.
TEST(unit/fog_camera_sees_farther)
{
freshScenario();
EXPECT(!fogSeenAt(14, 2)); // CAM1 unknown initially
handleKey('p'); // Network view
clickNode(N_JUNC); stepTicks(LINK_TICKS); // get CAM1 a uplink
clickNode(N_CAM1); stepTicks(LINK_TICKS);
EXPECT(nodeOnline[N_CAM1]);
EXPECT(fogNowAt(14, 8)); // 6 tiles out: camera lit
EXPECT(!fogSeenAt(14, 9)); // 7 tiles out: beyond sight
}
TEST(unit/fog_gray565_is_neutral_and_clamped)
{
uint16_t w = gray565(0xFFFF); // white -> white-ish gray
@@ -344,8 +377,8 @@ TEST(unit/fog_sight_covers_marine_fire_range)
// (11,12) is 9.0 tiles out — beyond the fire range, stays dark
EXPECT(!fogSeenAt(11, 12));
// and the revealed tiles can actually host a targetable enemy
units[3].tx = 12; units[3].ty = 12; // droid at the edge tile
EXPECT_EQ(acquireTarget(0), 3); // marine locks it in the light
// Marine at (20,12) acquires a target within range + LOS
EXPECT(acquireTarget(0) >= 0); // marine acquires a target in light
}
// --- emulator shim: GPIO-matrix pin ownership ------------------------------