another version of tracing across buses

This commit is contained in:
2020-08-17 00:32:59 +03:00
parent efb5cbe484
commit c49454bb03
3 changed files with 55 additions and 57 deletions

View File

@@ -27,7 +27,7 @@ class QAD_EXPORT BlockViewWavetrace {
public:
BlockViewWavetrace(int width = 1, int height = 1);
enum CellState {Empty = -1, Blocked = -2, Jump = -3};
enum CellState {Empty = -1, Blocked = -2, HorizontalBus = -3, VerticalBus = -4};
enum Direction {NoTrace, Horizontal, Vertical};
int width() const {return wid;}
@@ -36,7 +36,7 @@ public:
void resize(const QSize & sz) {resize(sz.width(), sz.height());}
void fill(short val = -1);
void fill(const QRect & rect, short val = -1);
void fill(const QPoint & point, short val = -1) {field[point.x()][point.y()] = val;}
void fill(const QPoint & point, short val = -1) {fill(point.x(), point.y(), val);}
void fill(int px, int py, short val);
void fill(BlockViewWavetrace::CellState val = Empty) {fill((short)val);}
void fill(const QRect & rect, BlockViewWavetrace::CellState val = Empty) {fill(rect, (short)val);}
@@ -52,9 +52,15 @@ public:
const QVector<QPoint> & path() const;
private:
struct Cell {
Cell(short v = Empty): value(v), direction(0) {}
short value;
short direction;
};
int wid, hei, max_steps;
Direction dir_;
QVector<QVector<short> > field;
QVector<QVector<Cell> > field;
QVector<QPoint> path_;
QVector<QPoint> jumps;
QPoint dps[4], st, fn;