#include <game.h>
Inheritance diagram for Game::
Signals | |
void | wasSolved () |
void | wasUnsolved () |
void | wasSolvedByHand () |
void | mapChanged () |
void | arrowsChanged (std::vector< Move > const &arrows) |
void | keeperDirectionChanged (AtomicMove::AtomicMoveType direction) |
void | virtualKeeperChanged (const QPoint &position) |
Public Methods | |
Game (Map *map, Movements const &moves) | |
void | setMapAndMoves (Map *map, Movements const &moves) |
bool | retroMode () const |
bool | setRetroMode (bool retro_mode) |
bool | tryMove (AtomicMove const &move) |
bool | tryMove (Move const &move) |
bool | tryPullMove (AtomicMove const &move) |
bool | tryFarMove (AtomicMove const &move) |
void | moveVirtualKeeper (AtomicMove const &move) |
bool | canUndo () const |
bool | canRedo () const |
int | numberOfPushes () const |
int | numberOfMoves () const |
int | numberOfEmptyGoals () const |
Movements const & | moves () const |
void | setMoves (Movements const &moves) |
bool | isSolved () const |
bool | showArrows () const |
bool | honorDeadlocks () const |
int | animation () const |
AtomicMove::AtomicMoveType | keeperDirection () const |
void | configChanged () |
void | setShowArrows (bool show) |
void | setHonorDeadlock (bool honor_deadlocks) |
void | setAnimation (int animation) |
void | emptyMoveQueue () |
bool | tryMoveKeeper (QPoint const &from, QPoint const &to) |
bool | tryMoveGem (QPoint const &from, QPoint const &to) |
void | jumpToStart () |
void | jumpToEnd () |
bool | tryUndo () |
bool | tryRedo () |
void | playMoves (bool from_start) |
void | forceUpdate () |
void | preventUpdate (bool prevent_update) |
Private Slots | |
void | processMoveQueue () |
Private Methods | |
void | removeVirtualKeeper () |
void | undo () |
void | redo () |
void | doMove (Move const &move) |
void | doAtomicMoves (Movements const &moves) |
void | doMoves (Movements const &moves) |
void | doUndoMove (Move const &move) |
void | addToMoveQueue (Move const &move) |
void | processMove () |
void | calcArrows () |
Movements | simplifyMove (Move const &move, Map const *map) const |
Movements | simplifyUndoMove (Move const &move, Map const *map) const |
bool | isDeadlockField (QPoint const &position) const |
bool | isDeadlockField (int index) const |
void | makeEndMap () |
Private Attributes | |
Map * | m_map |
int | m_width |
int | m_height |
int | m_size |
int | m_xy_offsets [4] |
Movements | m_moves |
std::deque< Move > | m_move_queue |
bool | m_undo_moves |
bool | m_handmade_moves |
bool | m_no_update |
bool | m_is_solved |
int | m_number_of_moves |
int | m_number_of_pushes |
bool | m_show_arrows |
bool | m_honor_deadlocks |
AtomicMove::AtomicMoveType | m_keeper_direction |
QPoint | m_virtual_keeper |
bool | m_wrap_virtual_keeper |
QTimer * | m_timer |
int | m_animation |
bool | m_retro_mode |
Map | m_backup_map |
Movements | m_backup_moves |
bool | m_prevent_update |
bool | m_in_play |
Static Private Attributes | |
int | s_fast_time |
int | s_normal_time |
int | s_slow_time |
|
Constructs the game.
|
|
Adds an atomic move to the move queue.
|
|
Returns the current animation speed. 0: no animation 1: fast animation 2: normal animation 3: slow animation |
|
This is emitted, if the arrows we changed. It's guaranteed, that a mapChanged() signal will be emitted later.
|
|
Calculates the possible moves and shows the arrows.
|
|
Returns true, if we can redo a move.
|
|
Returns true, if we can undo a move.
|
|
Call this, when the config file has changed.
|
|
Puts the given atomic moves in the move queue. Note that the move queue will <e>not</e> be emptied and the moves are <e>not</e> stored in m_moves.
|
|
Puts the given move in the move queue. Note that the move queue will be emptied before. The move will be added to m_moves.
|
|
Puts the given moves in the move queue. Note that the move queue will be emptied before. The move will be added to m_moves.
|
|
Puts the given undo move in the move queue. Note that the move queue will be emptied before. m_moves will not be changed.
|
|
Empties the move queue. After this call, the map and the moves are corresponding. |
|
Updates the map.
|
|
Returns true, if we honor deadlock fields.
|
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Returns true, if the given field is a deadlock field. If m_honor_deadlocks is false, this alsways returns false.
|
|
Returns true, if the map is currently solved.
|
|
Jumps to the end position of the moves made.
|
|
Jumps to the start position.
|
|
Returns the current direction of the keeper.
|
|
This is emitted, if the keeper direction was changed. It's guaranteed, that a mapChanged() signal will be emitted later.
|
|
Moves all gems to the goals and sets the keeper to a reasonable position. Note that the keeper should not be located on a goal field. |
|
This is emitted, if the map was changed.
|
|
Moves the virtual keeper.
|
|
Returns the moves. Note that unless you call emptyMoveQueue(), the map may lay behind the moves. |
|
Returns the number of empty goals (goals without a gem).
|
|
Returns the number of moves currently made.
|
|
Returns the number of pushes currently made.
|
|
Plays the moves.
|
|
Enables or disables all updates.
|
|
Processes a single move in the move queue.
|
|
Processes them move queue.
|
|
Redoes a move.
|
|
Removes the virtual keeper.
|
|
Returns true, if we are in retro mode. Note that setMapAndMoves() will unset the retro mode. |
|
Sets the animation speed.
|
|
Sets if the should honor deadlock fields.
|
|
Sets a new map with movements.
|
|
Sets new moves. Note that we automatically jump to the actual move.
|
|
Sets the retro mode. If you switch to retro mode and the keeper sits on a goal, we don't switch to retro mode.
|
|
Sets if we should display arrows.
|
|
Returns true, if we show arrows.
|
|
Returns a simplified version of a move.
|
|
Returns a simplified version of a undo move.
|
|
Tries to move the keeper as far in a direction as possible. If the first move would push a stone, we move the stone as far as possible and in the other case we move as far, as we reach a wall or a stone.
|
|
Tries to make the given move.
|
|
Tries to make the given atomic move.
|
|
Tries to move a gem from one point to the other.
|
|
Tries to move the keeper.
|
|
Tries to move the keeper and pull a gem.
|
|
Tries to redo a move.
|
|
Tries to undo a move.
|
|
Undoes a move.
|
|
This is emitted, if the virtual keeper was moved.
|
|
This is emitted, whenever the map is solved.
|
|
This is emitted, whenever the map was solved by a try***() function (so not by undo, redo, play ...).
|
|
Emitted of we leave a solution.
|
|
The animation speed.
|
|
The backup map.
|
|
The backup moves.
|
|
If true, the moves in the queue are handmade moves.
|
|
The height of the map.
|
|
If true, we honor deadlock fields.
|
|
If true, we are playing the moves.
|
|
If true, the level is solved.
|
|
The keeper direction.
|
|
The current map.
|
|
The moves in the move queue.
|
|
The current moves.
|
|
If true, we don't call mapChanged() in processMoveQueue().
|
|
The number of moves made.
|
|
The number of pushes made.
|
|
If true, we prevent updates.
|
|
If true, we are in retro mode.
|
|
If true, we also calculate valid pushes and the corresponding arrows.
|
|
m_width * m_height.
|
|
The animation timer.
|
|
If true, the moves in the queue are undo moves.
|
|
The position of the virtual keeper.
|
|
The width of the map.
|
|
If true, we wrap the virtual keeper around the sides of the map.
|
|
The offsets for nb calculation.
|
|
The time for fast animation.
|
|
The time for normal animation.
|
|
The time for slow animation.
|