fix bug where selecting the same layout for a shipyard discarded the current progress and buffers

This commit is contained in:
2026-08-06 19:18:45 +02:00
parent cd31af2611
commit 9a3b6c10d6
4 changed files with 160 additions and 2 deletions

View File

@@ -15,8 +15,23 @@ struct PlacedModule
Rotation rotation;
};
inline bool operator==(const PlacedModule& a, const PlacedModule& b)
{
return a.moduleId == b.moduleId && a.position == b.position && a.rotation == b.rotation;
}
// The complete module configuration for a shipyard's current ship (REQ-MOD-CONFIG).
struct ShipLayoutConfig
{
std::vector<PlacedModule> placedModules;
};
// Deliberately order-sensitive: two layouts holding the same modules in a different
// vector order compare unequal. This only decides whether applying a layout is a no-op
// (REQ-MAT-INPUT-BUFFER), so the conservative answer is the safe one -- reporting a
// change that is not one costs a buffer reset, reporting no change when there is one
// would leave the shipyard stale.
inline bool operator==(const ShipLayoutConfig& a, const ShipLayoutConfig& b)
{
return a.placedModules == b.placedModules;
}