Implement deferred L-shaped belt drag placement

This commit is contained in:
2026-07-21 21:05:31 +02:00
parent 1cbc695bc5
commit b2c1ea34fd
8 changed files with 444 additions and 31 deletions

View File

@@ -0,0 +1,27 @@
#pragma once
#include <vector>
#include <QPoint>
#include "Rotation.h"
// One tile of a belt drag-placement path: the tile coordinate and the belt
// orientation it should be given (REQ-BLD-BELT-DRAG).
struct BeltPathTile
{
QPoint tile;
Rotation rotation;
};
// Computes the rectilinear (L-shaped) belt path from `anchor` to `cursor` for a
// belt whose current orientation is `orientation` (REQ-BLD-BELT-DRAG). The path
// first runs along the axis parallel to `orientation` (horizontal for East/West,
// vertical for North/South), stepping toward the cursor's coordinate on that axis
// to the corner tile, then runs along the orthogonal axis to the cursor tile. Each
// tile is oriented to point toward the next tile along the path; the final tile
// keeps the direction of its incoming step, and a single-tile path keeps
// `orientation`. Returned tiles are ordered from anchor to cursor with no duplicate
// corner tile.
std::vector<BeltPathTile> computeBeltDragPath(QPoint anchor, QPoint cursor,
Rotation orientation);