penguins
1.0.0
|
Go to the source code of this file.
Movement phase functions.
Definition in file movement.h.
Data Structures | |
struct | PossibleSteps |
Exists purely to wrap an array of the numbers of steps in every possible Direction. More... | |
Functions | |
void | movement_begin (Game *game) |
Enters the GAME_PHASE_MOVEMENT phase, can only be called in GAME_PHASE_SETUP_DONE. More... | |
void | movement_end (Game *game) |
Exits the GAME_PHASE_MOVEMENT phase and switches to GAME_PHASE_SETUP_DONE. More... | |
int | movement_switch_player (Game *game) |
Performs the player switching logic for the movement phase. More... | |
bool | any_valid_player_move_exists (const Game *game, int player_idx) |
MovementError | validate_movement_start (const Game *game, Coords start) |
MovementError | validate_movement (const Game *game, Coords start, Coords target, Coords *fail) |
void | move_penguin (Game *game, Coords start, Coords target) |
Creates a GameLogMovement entry. The requested move must be valid. More... | |
void | undo_move_penguin (Game *game) |
Removes a GameLogMovement entry from the log and undoes it. More... | |
int | count_obstructed_directions (const Game *game, Coords penguin) |
PossibleSteps | calculate_penguin_possible_moves (const Game *game, Coords start) |
enum MovementError |
Definition at line 16 of file movement.h.
void movement_begin | ( | Game * | game | ) |
Enters the GAME_PHASE_MOVEMENT phase, can only be called in GAME_PHASE_SETUP_DONE.
Definition at line 11 of file movement.c.
void movement_end | ( | Game * | game | ) |
Exits the GAME_PHASE_MOVEMENT phase and switches to GAME_PHASE_SETUP_DONE.
Definition at line 20 of file movement.c.
int movement_switch_player | ( | Game * | game | ) |
Performs the player switching logic for the movement phase.
Finds the next player who can make a move, sets Game::current_player_index to that player and returns their index. If no players can make any moves returns a negative number.
Definition at line 31 of file movement.c.
bool any_valid_player_move_exists | ( | const Game * | game, |
int | player_idx | ||
) |
Definition at line 47 of file movement.c.
Referenced by PlayerInfoBox::update_data().
MovementError validate_movement_start | ( | const Game * | game, |
Coords | start | ||
) |
Definition at line 58 of file movement.c.
Referenced by PlayerMovementController::on_mouse_up(), and PlayerMovementController::update_status_bar().
MovementError validate_movement | ( | const Game * | game, |
Coords | start, | ||
Coords | target, | ||
Coords * | fail | ||
) |
Definition at line 76 of file movement.c.
Referenced by PlayerMovementController::on_mouse_up(), PlayerMovementController::paint_overlay(), and PlayerMovementController::update_status_bar().
Creates a GameLogMovement entry. The requested move must be valid.
Definition at line 118 of file movement.c.
Referenced by BotMovementThread::Entry(), and PlayerMovementController::on_mouse_up().
void undo_move_penguin | ( | Game * | game | ) |
Removes a GameLogMovement entry from the log and undoes it.
Definition at line 142 of file movement.c.
Definition at line 50 of file movement.h.
|
inline |
Definition at line 64 of file movement.h.
Referenced by PlayerMovementController::update_tile_attributes().