Rename Demolish to Deconstruct
This commit is contained in:
@@ -974,7 +974,7 @@ TEST_CASE("BeltSystem: unpaired entry blocks items at front", "[belt]")
|
||||
REQUIRE(bs.peekItem(Port{QPoint(3, 0), Rotation::East}).has_value());
|
||||
}
|
||||
|
||||
TEST_CASE("BeltSystem: demolish entry discards transit items", "[belt]")
|
||||
TEST_CASE("BeltSystem: deconstruct entry discards transit items", "[belt]")
|
||||
{
|
||||
BeltSystem bs(kFastBeltSpeed);
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ TEST_CASE("BuildingSystem: placed building enters construction queue", "[buildin
|
||||
REQUIRE(bs.findSite(id) != nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE("BuildingSystem: demolishing a construction site removes it instantly with full refund",
|
||||
TEST_CASE("BuildingSystem: deconstructing a construction site removes it instantly with full refund",
|
||||
"[building]")
|
||||
{
|
||||
PlacementFixture f;
|
||||
@@ -274,8 +274,8 @@ TEST_CASE("BuildingSystem: demolishing a construction site removes it instantly
|
||||
f.bs.place(BuildingType::Miner, QPoint(0, 0), Rotation::East, 0).value();
|
||||
|
||||
// Still queued for construction (not yet built): instant removal, full cost
|
||||
// refunded immediately, never entering the deconstruction queue (REQ-BLD-DEMOLISH).
|
||||
const int refund = f.bs.demolish(id, 0);
|
||||
// refunded immediately, never entering the deconstruction queue (REQ-BLD-DECONSTRUCT).
|
||||
const int refund = f.bs.deconstruct(id, 0);
|
||||
|
||||
REQUIRE(refund == 15); // Miner cost = 15
|
||||
REQUIRE_FALSE(f.bs.isTileOccupied(QPoint(0, 0)));
|
||||
@@ -366,7 +366,7 @@ static void runUntilBuilt(PlacementFixture& f, BuildingId id, Tick& tick)
|
||||
REQUIRE(f.bs.findBuilding(id) != nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE("BuildingSystem: demolishing a built building queues it; refund credited on completion",
|
||||
TEST_CASE("BuildingSystem: deconstructing a built building queues it; refund credited on completion",
|
||||
"[building][decon]")
|
||||
{
|
||||
PlacementFixture f;
|
||||
@@ -376,9 +376,9 @@ TEST_CASE("BuildingSystem: demolishing a built building queues it; refund credit
|
||||
Tick tick = 0;
|
||||
runUntilBuilt(f, id, tick);
|
||||
|
||||
// Demolishing a built building returns nothing immediately and queues it,
|
||||
// Deconstructing a built building returns nothing immediately and queues it,
|
||||
// stopping it operating while its tiles stay occupied (REQ-BLD-DECON-QUEUE).
|
||||
const int refund = f.bs.demolish(id, tick);
|
||||
const int refund = f.bs.deconstruct(id, tick);
|
||||
REQUIRE(refund == 0);
|
||||
REQUIRE(f.bs.isQueuedForDeconstruction(id));
|
||||
REQUIRE(f.bs.isTileOccupied(QPoint(0, 0)));
|
||||
@@ -403,8 +403,8 @@ TEST_CASE("BuildingSystem: deconstruction queue removes one building at a time",
|
||||
runUntilBuilt(f, b, tick);
|
||||
|
||||
// Queue both in one tick; 'a' is at the front of the deconstruction queue.
|
||||
f.bs.demolish(a, tick);
|
||||
f.bs.demolish(b, tick);
|
||||
f.bs.deconstruct(a, tick);
|
||||
f.bs.deconstruct(b, tick);
|
||||
REQUIRE(f.bs.isQueuedForDeconstruction(a));
|
||||
REQUIRE(f.bs.isQueuedForDeconstruction(b));
|
||||
|
||||
@@ -432,7 +432,7 @@ TEST_CASE("BuildingSystem: cancelling deconstruction resumes the building with n
|
||||
Tick tick = 0;
|
||||
runUntilBuilt(f, id, tick);
|
||||
|
||||
f.bs.demolish(id, tick);
|
||||
f.bs.deconstruct(id, tick);
|
||||
REQUIRE(f.bs.isQueuedForDeconstruction(id));
|
||||
|
||||
// Un-queue before it drains: it operates again, no refund, tiles still occupied.
|
||||
@@ -460,7 +460,7 @@ TEST_CASE("BuildingSystem: queued belt stops transporting; cancel restores it",
|
||||
|
||||
// Queuing a belt unregisters its tile from the belt subsystem, so it no longer
|
||||
// accepts or transports items, though the tile stays occupied (REQ-BLD-DECON-QUEUE).
|
||||
f.bs.demolish(id, tick);
|
||||
f.bs.deconstruct(id, tick);
|
||||
REQUIRE_FALSE(f.belts.tryPutItem(QPoint(0, 0), makeItem("iron_ore"), Rotation::East));
|
||||
REQUIRE(f.bs.isTileOccupied(QPoint(0, 0)));
|
||||
|
||||
@@ -482,7 +482,7 @@ TEST_CASE("BuildingSystem: splitter filters survive a queue/un-queue round-trip"
|
||||
|
||||
// Queue: the belt subsystem tile (and its filters) are unregistered, but the
|
||||
// filters are captured so an un-queue can restore them.
|
||||
f.bs.demolish(id, tick);
|
||||
f.bs.deconstruct(id, tick);
|
||||
REQUIRE_FALSE(f.belts.getSplitterInfo(QPoint(0, 0)).has_value());
|
||||
|
||||
f.bs.cancelDeconstruction(id);
|
||||
|
||||
@@ -59,7 +59,7 @@ TEST_CASE("apply(PlaceBuildingCommand) with recipe matches place-then-setRecipe"
|
||||
REQUIRE(viaCommand.computeStateChecksum() == viaDirect.computeStateChecksum());
|
||||
}
|
||||
|
||||
TEST_CASE("apply(DemolishCommand) matches direct demolish", "[command]")
|
||||
TEST_CASE("apply(DeconstructCommand) matches direct deconstruct", "[command]")
|
||||
{
|
||||
Simulation viaCommand(loadConfig(), 99);
|
||||
Simulation viaDirect(loadConfig(), 99);
|
||||
@@ -70,11 +70,11 @@ TEST_CASE("apply(DemolishCommand) matches direct demolish", "[command]")
|
||||
SimulationTestAccess::place(viaDirect, BuildingType::Miner, QPoint(-3, 0), Rotation::East).value();
|
||||
REQUIRE(idA == idB);
|
||||
|
||||
DemolishCommand command;
|
||||
DeconstructCommand command;
|
||||
command.id = idA;
|
||||
viaCommand.apply(command);
|
||||
|
||||
SimulationTestAccess::demolish(viaDirect, idB);
|
||||
SimulationTestAccess::deconstruct(viaDirect, idB);
|
||||
|
||||
REQUIRE(viaCommand.computeStateChecksum() == viaDirect.computeStateChecksum());
|
||||
}
|
||||
@@ -96,8 +96,8 @@ TEST_CASE("apply(CancelDeconstructionCommand) matches direct cancelDeconstructio
|
||||
viaCommand.tick();
|
||||
viaDirect.tick();
|
||||
}
|
||||
SimulationTestAccess::demolish(viaCommand, idA);
|
||||
SimulationTestAccess::demolish(viaDirect, idB);
|
||||
SimulationTestAccess::deconstruct(viaCommand, idA);
|
||||
SimulationTestAccess::deconstruct(viaDirect, idB);
|
||||
|
||||
CancelDeconstructionCommand command;
|
||||
command.id = idA;
|
||||
|
||||
@@ -22,7 +22,7 @@ GameConfig loadConfig()
|
||||
constexpr int kScriptTicks = 2000;
|
||||
|
||||
// Runs a fixed scripted session and returns the full-state checksum after every
|
||||
// tick. The script places a small factory, demolishes part of it mid-run, and
|
||||
// tick. The script places a small factory, deconstructs part of it mid-run, and
|
||||
// otherwise lets waves/combat run so the RNG stream and ECS state are exercised.
|
||||
std::vector<std::uint64_t> runScriptedSession(unsigned int seed)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ std::vector<std::uint64_t> runScriptedSession(unsigned int seed)
|
||||
{
|
||||
if (t == 500)
|
||||
{
|
||||
// Demolish the second belt mid-run to exercise the removal paths.
|
||||
// Deconstruct the second belt mid-run to exercise the removal paths.
|
||||
SimulationTestAccess::place(sim, BuildingType::Smelter, QPoint(-3, 3), Rotation::East);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,12 +77,12 @@ TEST_CASE("parseCommand round-trips every command verb", "[replay]")
|
||||
ClearBeltTilesCommand clear;
|
||||
clear.tiles = { QPoint(0, 0), QPoint(-1, 4) };
|
||||
|
||||
DemolishCommand demolish;
|
||||
demolish.id = 5;
|
||||
DeconstructCommand deconstruct;
|
||||
deconstruct.id = 5;
|
||||
|
||||
for (const Command* command : { static_cast<const Command*>(&filters),
|
||||
static_cast<const Command*>(&clear),
|
||||
static_cast<const Command*>(&demolish) })
|
||||
static_cast<const Command*>(&deconstruct) })
|
||||
{
|
||||
const std::string text = serializeCommand(*command);
|
||||
const std::shared_ptr<Command> parsed = parseCommand(text);
|
||||
|
||||
@@ -83,11 +83,11 @@ TEST_CASE("serializeCommand: splitter filters are length-prefixed", "[replay]")
|
||||
== "splitterfilters 4 7 2 iron_ore copper_ore 1 coal");
|
||||
}
|
||||
|
||||
TEST_CASE("serializeCommand: demolish / rotate / schematic / clearbelt", "[replay]")
|
||||
TEST_CASE("serializeCommand: deconstruct / rotate / schematic / clearbelt", "[replay]")
|
||||
{
|
||||
DemolishCommand demolish;
|
||||
demolish.id = 12;
|
||||
REQUIRE(serializeCommand(demolish) == "demolish 12");
|
||||
DeconstructCommand deconstruct;
|
||||
deconstruct.id = 12;
|
||||
REQUIRE(serializeCommand(deconstruct) == "deconstruct 12");
|
||||
|
||||
RotateInPlaceCommand rotate;
|
||||
rotate.id = 7;
|
||||
|
||||
@@ -33,7 +33,7 @@ struct SimulationTestAccess
|
||||
return sim.tryPlaceBuilding(type, anchor, rotation);
|
||||
}
|
||||
|
||||
static void demolish(Simulation& sim, BuildingId id) { sim.demolish(id); }
|
||||
static void deconstruct(Simulation& sim, BuildingId id) { sim.deconstruct(id); }
|
||||
|
||||
static void cancelDeconstruction(Simulation& sim, BuildingId id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user