implement building system
This commit is contained in:
28
src/lib/config/SurfaceMask.h
Normal file
28
src/lib/config/SurfaceMask.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <QPoint>
|
||||
#include <QSize>
|
||||
|
||||
#include "Port.h"
|
||||
#include "Rotation.h"
|
||||
|
||||
// Parsed representation of a building's surface_mask after applying rotation.
|
||||
// All coordinates are relative to the building's anchor tile (the point passed
|
||||
// to BuildingSystem::place), which corresponds to (0,0) in this system.
|
||||
struct ParsedSurfaceMask
|
||||
{
|
||||
QSize footprint; // bounding box of body cells (A + S tiles)
|
||||
std::vector<QPoint> bodyCells; // relative positions of A and S tiles
|
||||
std::vector<Port> outputPorts; // port.tile = cell adjacent to body, outside footprint;
|
||||
// port.direction = flow direction away from building
|
||||
std::vector<QPoint> shipDockCells; // relative positions of S tiles (subset of bodyCells)
|
||||
};
|
||||
|
||||
// Parse a surface_mask definition (as loaded from TOML) and apply the given
|
||||
// rotation. The canonical mask orientation corresponds to Rotation::East.
|
||||
// Rotations are applied clockwise (East=0, South=90°, West=180°, North=270°).
|
||||
ParsedSurfaceMask parseSurfaceMask(const std::vector<std::string>& rows,
|
||||
Rotation rotation);
|
||||
Reference in New Issue
Block a user