Files
dota_factory/src/lib/config/SurfaceMask.h
2026-04-19 20:53:08 +02:00

29 lines
1.2 KiB
C++

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