drop removeBuilding, which nothing has called for a while
A public mutator that erased a building with no refund and no deconstruction queue, documented as being "used for deaths". Nothing calls it: stations and the HQ became ECS entities, so a death releases its tiles through unregisterTileOccupancy instead, and every player-driven removal goes through deconstruct. Worth removing rather than leaving inert -- it was a way to take a building out of the world that skipped the refund and the queue, sitting in public view on the class whose whole job is that lifecycle. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
@@ -403,27 +403,6 @@ BuildingId BuildingSystem::placeImmediate(FactoryState& state, BuildingType type
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BuildingSystem::removeBuilding(FactoryState& state, BuildingId id)
|
|
||||||
{
|
|
||||||
for (std::vector<Building>::iterator it = state.buildings.begin();
|
|
||||||
it != state.buildings.end();
|
|
||||||
++it)
|
|
||||||
{
|
|
||||||
if (it->id == id)
|
|
||||||
{
|
|
||||||
if (it->type == BuildingType::Belt || it->type == BuildingType::Splitter
|
|
||||||
|| it->type == BuildingType::TunnelEntry || it->type == BuildingType::TunnelExit)
|
|
||||||
{
|
|
||||||
m_belts.removeTile(it->anchor);
|
|
||||||
}
|
|
||||||
state.grid.release(it->bodyCells);
|
|
||||||
state.buildings.erase(it);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BuildingSystem::forEachBuilding(FactoryState& state, std::function<void(Building&)> fn)
|
void BuildingSystem::forEachBuilding(FactoryState& state, std::function<void(Building&)> fn)
|
||||||
{
|
{
|
||||||
for (Building& b : state.buildings)
|
for (Building& b : state.buildings)
|
||||||
|
|||||||
@@ -112,10 +112,6 @@ public:
|
|||||||
const std::vector<std::string>& surfaceMask,
|
const std::vector<std::string>& surfaceMask,
|
||||||
QPoint anchor, Rotation rotation);
|
QPoint anchor, Rotation rotation);
|
||||||
|
|
||||||
// Remove an operational building by id without refund (used for deaths).
|
|
||||||
// Returns true if found and removed.
|
|
||||||
bool removeBuilding(FactoryState& state, BuildingId id);
|
|
||||||
|
|
||||||
// Mutable iteration over all operational buildings.
|
// Mutable iteration over all operational buildings.
|
||||||
void forEachBuilding(FactoryState& state, std::function<void(Building&)> fn);
|
void forEachBuilding(FactoryState& state, std::function<void(Building&)> fn);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user