From 8008b78db06af59e48bcededbb2ac824732c1ad4 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Sun, 15 Nov 2026 11:06:33 +0100 Subject: [PATCH] Fix reinforcement slot index after MAX_UNITS refactor; align E2E freeze-tint sampling --- emulator/tests/e2e_tests.cpp | 6 +++--- emulator/tests/integration_tests.h | 2 +- emulator/tests/unit_tests.h | 2 +- src/netdeck/NetDeck.ino | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/emulator/tests/e2e_tests.cpp b/emulator/tests/e2e_tests.cpp index 8c3939c..b74277d 100644 --- a/emulator/tests/e2e_tests.cpp +++ b/emulator/tests/e2e_tests.cpp @@ -133,10 +133,10 @@ TEST(e2e/boot_and_controls) // color 0x1F1F is never rendered (transparency held). Sampled on the // left side of the top wall row, away from the top-right anchored // "* TACTICAL FREEZE *" text, so font metric drift can't leak in. - EXPECT(test::pixelIs565(10, 0, 0x0000)); // stripe dot (2,0) + EXPECT(test::pixelIs565(10, 8, 0x0000)); // stripe dot (2,0) of cell row 1 EXPECT(test::pixelIs565(9, 1, 0x0000)); // stripe dot (1,1) EXPECT(test::pixelIs565(8, 2, 0x0000)); // stripe dot (0,2) - EXPECT(!test::pixelIs565(12, 0, 0x0000)); // off-stripe: frozen view + EXPECT(!test::pixelIs565(12, 8, 0x0000)); // off-stripe: frozen view EXPECT(!test::pixelIs565(12, 0, 0x1F1F)); // key color never rendered for (int yy = 0; yy < 8; yy++) for (int xx = 8; xx < 16; xx++) @@ -154,7 +154,7 @@ TEST(e2e/network_journey) EXPECT(pumpUntil(30.0, spikeSeen)); // ... trace ... feedback spike EXPECT(test::serialHas("[spawn] reinforcement droid")); stepTicks(1); - EXPECT(units[6].alive); + EXPECT(units[7].alive); EXPECT(heatT > 0); // OVERHEAT lockout engaged } diff --git a/emulator/tests/integration_tests.h b/emulator/tests/integration_tests.h index e028534..98088ff 100644 --- a/emulator/tests/integration_tests.h +++ b/emulator/tests/integration_tests.h @@ -73,7 +73,7 @@ TEST(integration/full_network_journey) EXPECT(traceActive); stepTicks(TRACE_TICKS); EXPECT(heatT > 0); // feedback spike cooldown - EXPECT(units[6].alive); // reinforcement spawned + EXPECT(units[7].alive); // reinforcement spawned EXPECT(!nodeOnline[N_JUNC]); // spike dropped the net } diff --git a/emulator/tests/unit_tests.h b/emulator/tests/unit_tests.h index bb5ffa6..d84b3b8 100644 --- a/emulator/tests/unit_tests.h +++ b/emulator/tests/unit_tests.h @@ -140,7 +140,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[6].alive); // reinforcement droid spawned + EXPECT(units[7].alive); // reinforcement droid spawned } TEST(unit/overheat_gates_daemons_and_sever) diff --git a/src/netdeck/NetDeck.ino b/src/netdeck/NetDeck.ino index 1aa5989..7062421 100644 --- a/src/netdeck/NetDeck.ino +++ b/src/netdeck/NetDeck.ino @@ -554,8 +554,8 @@ struct Unit { bool patFlip; }; static Unit units[nd::MAX_UNITS]; -// 0,1 marines | 2 patrol droid | 3 stationary droid | 4 heavy | 5 turret -// 6 = reinforcement slot (spawns on the feedback spike) +// 0,1 marines | 2 patrol droid | 3 stationary droid | 4 heavy | 5,6 turrets +// 7 = reinforcement slot (spawns on the feedback spike) // transient hitscan tracers / impact flashes struct Tracer { @@ -856,13 +856,13 @@ static void stepUnits() // reinforcement droid queued by the feedback spike if (reinforcePending) { reinforcePending = false; - if (!units[6].alive) { + if (!units[7].alive) { // spawn inside the server room by the blast door, first free tile static const int SP[5][2] = { {31,12}, {30,12}, {32,12}, {31,11}, {31,13} }; for (int s = 0; s < 5; s++) { int sx = SP[s][0], sy = SP[s][1]; - if (walkable(sx, sy) && !tileOccupied(sx, sy, 6)) { - spawnUnit(6, U_DROID, sx, sy); + if (walkable(sx, sy) && !tileOccupied(sx, sy, 7)) { + spawnUnit(7, U_DROID, sx, sy); Serial.printf("[spawn] reinforcement droid at %d,%d\n", sx, sy); break; }