|
Cute Chess
0.1
|
Details of a board transition caused by a move. More...
#include <boardtransition.h>
Classes | |
| struct | Drop |
| A piece drop. More... | |
| struct | Move |
| Movement on the board. More... | |
Public Member Functions | |
| void | addDrop (const Piece &piece, const Square &target) |
| void | addMove (const Square &source, const Square &target) |
| void | addReservePiece (const Piece &piece) |
| void | addSquare (const Square &square) |
| BoardTransition () | |
| void | clear () |
| QList< Drop > | drops () const |
| bool | isEmpty () const |
| QList< Move > | moves () const |
| QList< Piece > | reserve () const |
| QList< Square > | squares () const |
Details of a board transition caused by a move.
This class stores information about the movement of pieces and changed squares on a chessboard. Two types of information are stored: movement, and changed squares and reserve pieces. The latter type of information is sufficient for updating the state of a graphical board, and the former can be used to display or animate the actual chessmove.
| Chess::BoardTransition::BoardTransition | ( | ) |
Creates a new empty BoardTransition object.
Adds a new piece drop of piece to target.
Adds a new "move" from source to target.
| void Chess::BoardTransition::addReservePiece | ( | const Piece & | piece | ) |
Adds a new changed reserve piece.
If piece already exists in the transition, this function does nothing.
| void Chess::BoardTransition::addSquare | ( | const Square & | square | ) |
Adds a new changed square.
If square already exists in the transition, this function does nothing.
| void Chess::BoardTransition::clear | ( | ) |
Clears all data, ie. empties the transition.
| QList< BoardTransition::Drop > Chess::BoardTransition::drops | ( | ) | const |
Returns a list of piece drops.
| bool Chess::BoardTransition::isEmpty | ( | ) | const |
Returns true if there are no transitions.
| QList< BoardTransition::Move > Chess::BoardTransition::moves | ( | ) | const |
Returns a list of "moves".
One chessmove can involve several moving pieces, and the actual chessmove may not be on the returned list.
1.8.11