Rename Demolish to Deconstruct

This commit is contained in:
2026-07-22 21:40:42 +02:00
parent b2ce20e6ad
commit e20a0bba67
30 changed files with 166 additions and 166 deletions

View File

@@ -67,7 +67,7 @@ struct WorldScroll
struct WorldConfig
{
int heightTiles; // REQ-GW-HEIGHT
int refundPercentage; // REQ-BLD-DEMOLISH
int refundPercentage; // REQ-BLD-DECONSTRUCT
double deconstructionTimeSeconds; // REQ-BLD-DECON-QUEUE
int startingBuildingBlocks; // REQ-HQ-STARTING-BLOCKS
double scrapDespawnSeconds; // REQ-RES-SCRAP-DROP

View File

@@ -16,11 +16,11 @@ SET(HDRS
${CMAKE_CURRENT_SOURCE_DIR}/BuilderModeExitedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/BlueprintModeExitedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/EscapeMenuRequestedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/DemolishModeChangedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/DeconstructModeChangedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/BuildingTypeSelectedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/BuildHotkeyPressedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/ExitBuilderModeRequestedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/DemolishModeToggleRequestedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/DeconstructModeToggleRequestedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/BlueprintPlacementRequestedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/ExitBlueprintModeRequestedEvent.h
${CMAKE_CURRENT_SOURCE_DIR}/TemporaryBlueprintRequestedEvent.h

View File

@@ -0,0 +1,10 @@
#pragma once
#include "Event.h"
class DeconstructModeChangedEvent : public Event
{
public:
explicit DeconstructModeChangedEvent(bool active) : active(active) {}
const bool active;
};

View File

@@ -0,0 +1,7 @@
#pragma once
#include "Event.h"
class DeconstructModeToggleRequestedEvent : public Event
{
};

View File

@@ -1,10 +0,0 @@
#pragma once
#include "Event.h"
class DemolishModeChangedEvent : public Event
{
public:
explicit DemolishModeChangedEvent(bool active) : active(active) {}
const bool active;
};

View File

@@ -1,7 +0,0 @@
#pragma once
#include "Event.h"
class DemolishModeToggleRequestedEvent : public Event
{
};

View File

@@ -52,7 +52,7 @@ public:
// tile are held and routed to one of the two outputs.
void placeSplitter(QPoint tile, Rotation outputA, Rotation outputB);
// Remove a belt or splitter tile (on demolish). Items are discarded.
// Remove a belt or splitter tile (on deconstruct). Items are discarded.
void removeTile(QPoint tile);
// -- Splitter filter configuration (REQ-BLD-SPLITTER) -------------------

View File

@@ -497,13 +497,13 @@ bool BuildingSystem::isPlacementValid(BuildingType type, QPoint anchor,
}
// ---------------------------------------------------------------------------
// Demolish
// Deconstruct
// ---------------------------------------------------------------------------
int BuildingSystem::demolish(BuildingId id, Tick currentTick)
int BuildingSystem::deconstruct(BuildingId id, Tick currentTick)
{
// Construction site? Removed instantly with the full refund; never queued
// for deconstruction (REQ-BLD-DEMOLISH).
// for deconstruction (REQ-BLD-DECONSTRUCT).
for (std::deque<ConstructionSite>::iterator it = m_constructionQueue.begin();
it != m_constructionQueue.end();
++it)
@@ -887,9 +887,9 @@ void BuildingSystem::tickDeconstruction(Tick currentTick)
return;
}
// Remove the building from the world and credit its refund (REQ-BLD-DEMOLISH).
// Remove the building from the world and credit its refund (REQ-BLD-DECONSTRUCT).
// Belt/tunnel/splitter tiles were already unregistered when the building was
// queued (see demolish), so only tile occupancy and the record remain.
// queued (see deconstruct), so only tile occupancy and the record remain.
for (std::vector<Building>::iterator it = m_buildings.begin();
it != m_buildings.end();
++it)
@@ -1632,7 +1632,7 @@ std::optional<BuildingId> BuildingSystem::findRotateInPlaceTarget(
BuildingType type, QPoint anchor, Rotation rot) const
{
// Tunnel Entries and Tunnel Exits cannot be rotated in place; re-orienting a
// tunnel requires demolishing and re-placing it (REQ-BLD-ROTATE-IN-PLACE).
// tunnel requires deconstructing and re-placing it (REQ-BLD-ROTATE-IN-PLACE).
if (type == BuildingType::TunnelEntry || type == BuildingType::TunnelExit)
{
return std::nullopt;

View File

@@ -54,7 +54,7 @@ public:
std::function<bool(const std::string&)> isItemUnlocked,
std::mt19937& rng);
// -- Placement / demolish ------------------------------------------------
// -- Placement / deconstruct ------------------------------------------------
// Returns the new entity id, or nullopt if the placement falls outside the
// world bounds (vertical extent and asteroid left edge). Belt and Splitter
// register with BeltSystem directly; other types enter the construction
@@ -77,13 +77,13 @@ public:
// Defaults to world.regions.asteroid_width_tiles at construction.
void setAsteroidWidth_tiles(int widthTiles) { m_asteroidWidth_tiles = widthTiles; }
// Mark a building or construction site for demolition (REQ-BLD-DEMOLISH).
// Mark a building or construction site for demolition (REQ-BLD-DECONSTRUCT).
// A construction site is removed instantly and the full cost is returned.
// A fully-built building is instead appended to the deconstruction queue
// (REQ-BLD-DECON-QUEUE) and stops operating at once; its (partial) refund is
// credited later, on completion in tickDeconstruction, so this returns 0 for
// it. Returns 0 for unknown ids and for a building already queued.
int demolish(BuildingId id, Tick currentTick);
int deconstruct(BuildingId id, Tick currentTick);
// Take a building back out of the deconstruction queue before it is removed
// (REQ-BLD-DECON-QUEUE). Clears its queued flag and resumes operation

View File

@@ -27,7 +27,7 @@ class GameConfig;
enum class CommandKind
{
PlaceBuilding,
Demolish,
Deconstruct,
CancelDeconstruction,
RotateInPlace,
SetRecipe,
@@ -74,15 +74,15 @@ struct PlaceBuildingCommand : Command
};
// Marks a building for demolition: a construction site is removed instantly, a
// built building is queued for deconstruction (REQ-BLD-DEMOLISH, REQ-BLD-DECON-QUEUE).
struct DemolishCommand : Command
// built building is queued for deconstruction (REQ-BLD-DECONSTRUCT, REQ-BLD-DECON-QUEUE).
struct DeconstructCommand : Command
{
DemolishCommand() : Command(CommandKind::Demolish) {}
DeconstructCommand() : Command(CommandKind::Deconstruct) {}
std::optional<BuildingId> id;
};
// Takes a building back out of the deconstruction queue (REQ-BLD-DEMOLISH-CLICK,
// REQ-BLD-DEMOLISH-BOX). No-op if the id is not currently queued.
// Takes a building back out of the deconstruction queue (REQ-BLD-DECONSTRUCT-CLICK,
// REQ-BLD-DECONSTRUCT-BOX). No-op if the id is not currently queued.
struct CancelDeconstructionCommand : Command
{
CancelDeconstructionCommand() : Command(CommandKind::CancelDeconstruction) {}

View File

@@ -128,8 +128,8 @@ std::string serializeCommand(const Command& command)
}
break;
}
case CommandKind::Demolish:
out << "demolish " << static_cast<const DemolishCommand&>(command).id.value();
case CommandKind::Deconstruct:
out << "deconstruct " << static_cast<const DeconstructCommand&>(command).id.value();
break;
case CommandKind::CancelDeconstruction:
out << "cancel_deconstruct "
@@ -243,9 +243,9 @@ std::shared_ptr<Command> parseCommand(const std::string& tokens)
}
return c;
}
if (verb == "demolish")
if (verb == "deconstruct")
{
std::shared_ptr<DemolishCommand> c = std::make_shared<DemolishCommand>();
std::shared_ptr<DeconstructCommand> c = std::make_shared<DeconstructCommand>();
BuildingId id = 0;
if (!(in >> id)) { return nullptr; }
c->id = id;

View File

@@ -231,8 +231,8 @@ void Simulation::apply(const Command& command)
}
break;
}
case CommandKind::Demolish:
demolish(*static_cast<const DemolishCommand&>(command).id);
case CommandKind::Deconstruct:
deconstruct(*static_cast<const DeconstructCommand&>(command).id);
break;
case CommandKind::CancelDeconstruction:
cancelDeconstruction(*static_cast<const CancelDeconstructionCommand&>(command).id);
@@ -1198,9 +1198,9 @@ std::optional<BuildingId> Simulation::tryPlaceBuilding(BuildingType type, QPoint
return m_buildingSystem->place(type, anchor, rotation, m_currentTick);
}
void Simulation::demolish(BuildingId id)
void Simulation::deconstruct(BuildingId id)
{
m_buildingBlocksStock += m_buildingSystem->demolish(id, m_currentTick);
m_buildingBlocksStock += m_buildingSystem->deconstruct(id, m_currentTick);
}
void Simulation::cancelDeconstruction(BuildingId id)

View File

@@ -142,7 +142,7 @@ private:
// Marks the building with the given id for demolition: a construction site is
// removed instantly (full refund), a built building is queued for timed
// deconstruction (REQ-BLD-DECON-QUEUE), refunded on completion.
void demolish(BuildingId id);
void deconstruct(BuildingId id);
// Takes a queued building back out of the deconstruction queue (REQ-BLD-DECON-QUEUE).
void cancelDeconstruction(BuildingId id);