dont require output belts to be aligned with output ports

This commit is contained in:
2026-04-22 21:15:39 +02:00
parent 36d6842f71
commit f29dc9862a
6 changed files with 45 additions and 61 deletions

View File

@@ -107,7 +107,7 @@ TEST_CASE("BuildingSystem: placing a belt registers it with BeltSystem", "[build
bs.place(BuildingType::Belt, QPoint(5, 5), Rotation::East, 0);
REQUIRE(belts.tryPutItem(eastPort(QPoint(5, 5)), makeItem("iron_ore")));
REQUIRE(belts.tryPutItem(QPoint(5, 5), makeItem("iron_ore")));
REQUIRE(bs.allBuildings().empty()); // belts do not create Building instances
}
@@ -145,6 +145,12 @@ TEST_CASE("BuildingSystem: demolish frees tiles and returns refund", "[building]
rng);
const EntityId id = bs.place(BuildingType::Miner, QPoint(0, 0), Rotation::East, 0);
// Miner construction_time_seconds = 10. completesAt = secondsToTicks(10) = 300.
// We need to process tick 300 itself, so run 301 ticks (ticks 0..300).
Tick tick = 0;
runTicks(bs, belts, static_cast<int>(secondsToTicks(10.0)) + 1, tick);
const int refund = bs.demolish(id);
// Miner cost = 15, refund = floor(15 * 75 / 100) = 11.
@@ -341,7 +347,7 @@ TEST_CASE("BuildingSystem: smelter input buffer fills from adjacent west-flowing
// Place west-flowing belt at (2,0): belt flows West, delivers to smelter.
belts.placeBelt(QPoint(2, 0), Rotation::West);
belts.tryPutItem(westPort(QPoint(2, 0)), makeItem("iron_ore"));
belts.tryPutItem(QPoint(2, 0), makeItem("iron_ore"));
bs.tickBeltPull();
@@ -493,7 +499,7 @@ TEST_CASE("BuildingSystem: reprocessing plant produces one cycle output then sta
belts.placeBelt(QPoint(-1, 0), Rotation::East);
for (int i = 0; i < 5; ++i)
{
belts.tryPutItem(eastPort(QPoint(-1, 0)), makeItem("scrap"));
belts.tryPutItem(QPoint(-1, 0), makeItem("scrap"));
bs.tickBeltPull();
}