Extract map-specific data into a generic MapSource interface

One interface (nd_mapsource.h) now owns everything map-specific: tiles,
rooms/doors/cameras, the network graph (nodes + edges with roles replacing
the hardcoded N_AIRLK/N_DOOR/N_HIVE indices) and the entity spawn list.
The scenario populates its structures once via selectMap() and never checks
which map is active.

- DemoMapSource: self-contained demo grid (moved out of the sketch), demo
  node/edge/spawn tables
- GenMapSource: adapts the random MapGenerator — now with L-corridors for
  guaranteed connectivity, doors that lead somewhere, airlock pad, terminal
  and crates (never on corridor tiles); network graph derived from the room
  chain, marine-first spawn list with droid patrols
- NetDeck.ino: all source branching removed; red trace follows the real
  active-link path (BFS HIVE->ROOT); reinforcement spawns near the blast door
- Tests: MapTest validates 50 generated runs + demo via the interface with
  an airlock flood-fill; new generated-map integration journey; test node
  handles resolve through the source (no hardcoded indices)
This commit is contained in:
Dejvino
2026-11-15 18:21:35 +01:00
parent 7b80854e1d
commit b38d5d4b56
10 changed files with 1296 additions and 172 deletions
+3 -3
View File
@@ -23,7 +23,7 @@ TEST(unit/map_queries)
EXPECT(walkable(34, 7)); // objective terminal 'T'
EXPECT(blocksSight(0, 0));
EXPECT(!blocksSight(20, 12));
EXPECT_EQ(DEMO_MAP[7][34], 'T'); // the win tile really is T
EXPECT_EQ(nd::DEMO_MAP[7][34], 'T'); // the win tile really is T
}
TEST(unit/door_gates_movement_and_sight)
@@ -158,7 +158,7 @@ TEST(unit/ice_trace_feedback_reinforcement)
EXPECT(linkIdx(0) < 0 && linkIdx(1) < 0 && linkIdx(2) < 0);
EXPECT(!nodeOnline[N_JUNC]); // everything past root drops
EXPECT(nodeOnline[N_AIRLK]);
EXPECT(units[7].alive); // reinforcement droid spawned
EXPECT(units[g_reinforceIdx].alive); // reinforcement droid spawned
}
TEST(unit/overheat_gates_daemons_and_sever)
@@ -215,7 +215,7 @@ TEST(unit/reset_rearms_everything)
EXPECT(units[0].alive && units[1].alive);
EXPECT_EQ(units[0].tx, 2); // back in the airlock
EXPECT_EQ(units[0].hp, STATS[U_MARINE].maxHp);
EXPECT(!units[7].alive); // reinforcement slot cleared
EXPECT(!units[g_reinforceIdx].alive); // reinforcement slot cleared
EXPECT(!doorOpen);
EXPECT_EQ(heatT, 0);
EXPECT(linkIdx(0) < 0 && linkIdx(1) < 0 && linkIdx(2) < 0);