fix bug where selecting the same layout for a shipyard discarded the current progress and buffers
This commit is contained in:
@@ -284,6 +284,21 @@ void BuildingSystem::setShipLayout(FactoryState& state, BuildingId id, const Shi
|
||||
{
|
||||
if (building.id == id)
|
||||
{
|
||||
// No-op if the layout is unchanged, so re-applying the layout a shipyard
|
||||
// already has does not cancel its production cycle or wipe its buffers
|
||||
// (REQ-MAT-INPUT-BUFFER, REQ-BLD-SHIPYARD). Confirming the layout dialog
|
||||
// without editing anything, and a blueprint configuration transfer onto an
|
||||
// already-matching shipyard (REQ-UI-BLUEPRINT-TRANSFER), both land here.
|
||||
// An unset layout counts as an empty one: the two are equivalent for
|
||||
// buffers, production, and the spawned ship (see the spawn path below),
|
||||
// so an empty layout arriving at an unconfigured shipyard changes nothing.
|
||||
const bool unchanged = building.shipLayout.has_value()
|
||||
? *building.shipLayout == layout
|
||||
: layout.placedModules.empty();
|
||||
if (unchanged)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (building.production.has_value())
|
||||
{
|
||||
building.production = std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user