QtCraft API C++ classes QML types Handbook

QcPathWindow Class

The cells around the start of one search (decision E-400): a box of 64 x 32 x 64 cells, each read from the world at most once per search, and the A* bookkeeping of its nodes. More...

Header: #include <server/pathing/QcPathWindow.h>

Public Functions

void begin(const QcBlockAccess &world, const QcPathCellTable &table, QcBlockPos centre)
quint8 cell(QcBlockPos pos)
void close(int index)
bool closed(int index) const
float cost(int index) const
QcPathGap gap(QcBlockPos pos) const
int indexOf(QcBlockPos pos) const
void open(int index, float cost, int parent)
int parent(int index) const
QcBlockPos positionOf(int index) const
bool visited(int index) const

Static Public Members

const int cellCount
const int halfHeight
const int halfWidth
const int sizeX
const int sizeY

Detailed Description

Arrays are allocated with the first search and reused; a generation number marks what belongs to the current search, so starting a search clears nothing. Cells outside the box count as unknown: a search never leaves it.

Member Function Documentation

void QcPathWindow::begin(const QcBlockAccess &world, const QcPathCellTable &table, QcBlockPos centre)

Starts a search around centre in world, path cells from table.

quint8 QcPathWindow::cell(QcBlockPos pos)

Returns the cell at pos (QcPathCell), read from the world on first use.

void QcPathWindow::close(int index)

Closes the visited node index.

bool QcPathWindow::closed(int index) const

Returns whether this search closed the node index.

float QcPathWindow::cost(int index) const

Returns the cost of the way to the visited node index.

QcPathGap QcPathWindow::gap(QcBlockPos pos) const

Returns the gap of an open door or trapdoor in the cell at pos, straight from the world (only cells with a panel, QcPathCell::hasPanel, ask for it; few enough not to cache).

int QcPathWindow::indexOf(QcBlockPos pos) const

Returns the index of the cell at pos inside the box; -1 outside.

void QcPathWindow::open(int index, float cost, int parent)

Visits the node index with the way's cost from parent.

int QcPathWindow::parent(int index) const

Returns the node the way to the visited node index comes from.

QcBlockPos QcPathWindow::positionOf(int index) const

Returns the position of the cell with the index index (indexOf()).

bool QcPathWindow::visited(int index) const

Returns whether this search visited the node index (A* state).

Member Variable Documentation

const int QcPathWindow::cellCount

The number of cells of the box.

const int QcPathWindow::halfHeight

Cells of the box above and below the centre.

const int QcPathWindow::halfWidth

Cells of the box on each side of the centre along x and z.

const int QcPathWindow::sizeX

The width of the box along x and z.

const int QcPathWindow::sizeY

The height of the box.