38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <QPoint>
|
|
|
|
#include "Rotation.h"
|
|
|
|
// A single module placed on a ship's layout grid (REQ-MOD-PLACEMENT).
|
|
struct PlacedModule
|
|
{
|
|
std::string moduleId;
|
|
QPoint position;
|
|
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;
|
|
}
|