make tests run again

This commit is contained in:
2026-04-24 20:30:20 +02:00
parent eba8caac31
commit fff5d43352
4 changed files with 39 additions and 65 deletions

View File

@@ -194,8 +194,7 @@ TEST_CASE("CombatSystem: no fire when target is out of range", "[combat]")
TEST_CASE("CombatSystem: player station fires at enemy ship in range", "[combat]")
{
const GameConfig cfg = loadConfig();
Simulation sim(cfg, 42);
Simulation sim(loadConfig(), 42);
// Find the player defence station.
EntityId stationId = kInvalidEntityId;
@@ -223,7 +222,7 @@ TEST_CASE("CombatSystem: player station fires at enemy ship in range", "[combat]
}
// Find a combat ship blueprint for the enemy.
const ShipDef* combatDef = findCombatShip(cfg);
const ShipDef* combatDef = findCombatShip(sim.config());
REQUIRE(combatDef != nullptr);
const EntityId enemyId = sim.ships().spawn(
@@ -246,8 +245,7 @@ TEST_CASE("CombatSystem: player station fires at enemy ship in range", "[combat]
TEST_CASE("CombatSystem: enemy station fires at player ship in range", "[combat]")
{
const GameConfig cfg = loadConfig();
Simulation sim(cfg, 42);
Simulation sim(loadConfig(), 42);
// Find the enemy defence station.
EntityId stationId = kInvalidEntityId;
@@ -265,7 +263,7 @@ TEST_CASE("CombatSystem: enemy station fires at player ship in range", "[combat]
}
REQUIRE(stationId != kInvalidEntityId);
const ShipDef* combatDef = findCombatShip(cfg);
const ShipDef* combatDef = findCombatShip(sim.config());
REQUIRE(combatDef != nullptr);
// Spawn a player ship right next to the enemy station.
@@ -291,10 +289,9 @@ TEST_CASE("CombatSystem: enemy station fires at player ship in range", "[combat]
TEST_CASE("CombatSystem: dead ship is removed after tick step 9", "[combat]")
{
const GameConfig cfg = loadConfig();
Simulation sim(cfg, 42);
Simulation sim(loadConfig(), 42);
const ShipDef* combatDef = findCombatShip(cfg);
const ShipDef* combatDef = findCombatShip(sim.config());
REQUIRE(combatDef != nullptr);
const EntityId shipId = sim.ships().spawn(combatDef->id, 1,
@@ -310,12 +307,11 @@ TEST_CASE("CombatSystem: dead ship is removed after tick step 9", "[combat]")
TEST_CASE("CombatSystem: scrap is spawned on ship death", "[combat]")
{
const GameConfig cfg = loadConfig();
Simulation sim(cfg, 42);
Simulation sim(loadConfig(), 42);
// Find a ship def that drops scrap.
const ShipDef* droppingDef = nullptr;
for (const ShipDef& def : cfg.ships.ships)
for (const ShipDef& def : sim.config().ships.ships)
{
if (def.loot.scrapDrop > 0)
{
@@ -337,8 +333,7 @@ TEST_CASE("CombatSystem: scrap is spawned on ship death", "[combat]")
TEST_CASE("CombatSystem: HQ death sets game over", "[combat]")
{
const GameConfig cfg = loadConfig();
Simulation sim(cfg, 42);
Simulation sim(loadConfig(), 42);
sim.buildings().forEachBuilding([](Building& b)
{