kapman
maze.cpp
Go to the documentation of this file.
91 m_cells[p_row][p_column].setCost(abs(m_resurrectionCell.y() - p_row) + abs(m_resurrectionCell.x() - p_column));
95 while (!closedList.contains(QPoint(m_resurrectionCell.x(), m_resurrectionCell.y())) && openList.size() != oldSize) {
171 // Save the path : from the target cell, go from each cell to its parent cell until reaching the starting cell
void init(const int p_nbRows, const int p_nbColumns)
Creates the Maze matrix.
Definition: maze.cpp:36
Definition: cell.h:37
QList< QPoint > getPathToGhostCamp(const int p_row, const int p_column) const
Gets the path, as a list of Cell coordinates, to go to the Ghost camp from the Cell whose coordinates...
Definition: maze.cpp:80
Cell getCell(const int p_row, const int p_column) const
Gets the Cell at the given coordinates.
Definition: maze.cpp:180
void removeAt(int i)
Cell * getParent() const
Gets the parent Cell of this Cell for A* pathfinding algorithm.
Definition: cell.cpp:55
int x() const
int y() const
int size() const
void setCellElement(const int p_row, const int p_column, Element *p_element)
Sets the Element that is on the Cell whose coordinates are given in parameters.
Definition: maze.cpp:52
void setCost(const int p_cost)
Sets a cost for the Cell, for A* pathfinding algorithm.
Definition: cell.cpp:51
void resetNbElem()
Resets the number of remaining Elements to the initial number.
Definition: maze.cpp:76
QPoint getCoords(Cell *p_cell) const
Gets the coordinates of the given Cell as a QPoint.
Definition: maze.cpp:188
void setResurrectionCell(QPoint p_resurrectionCell)
Sets the cell on witch the ghosts resurrect from prey state.
Definition: maze.cpp:63
void append(const T &value)
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:30
void setCellType(const int p_row, const int p_column, const Cell::Type p_type)
Sets the CellType of the Cell whose coordinates are given in parameters.
Definition: maze.cpp:45
bool contains(const T &value) const
void setParent(Cell *p_parent)
Sets the parent Cell of this Cell for A* pathfinding algorithm.
Definition: cell.cpp:59
void setX(int x)
void setY(int y)
void prepend(const T &value)
int getTotalNbElem() const
Gets the number of Elements initially on the Maze.
Definition: maze.cpp:219
int getNbElem() const
Gets the number of remaining Elements still on the Maze.
Definition: maze.cpp:215
void allElementsEaten()
Emitted when all the elements on the Maze have been eaten.
int getRowFromY(const qreal p_y) const
Gets the row index corresponding to the given y-coordinate.
Definition: maze.cpp:199
int getColFromX(const qreal p_x) const
Gets the column index corresponding to the given x-coordinate.
Definition: maze.cpp:203
QPoint getResurrectionCell() const
Gets the cell on witch the ghosts resurects.
Definition: maze.cpp:223
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.