implement building system

This commit is contained in:
2026-04-19 20:50:42 +02:00
parent c70b5c8f08
commit bf29cc40e3
19 changed files with 1818 additions and 7 deletions

View 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);