|
penguins
1.0.0
|
Go to the source code of this file.
Placement phase functions.
Definition in file placement.h.
Enumerations | |
| enum | PlacementError { PLACEMENT_VALID = 0 , PLACEMENT_OUT_OF_BOUNDS , PLACEMENT_EMPTY_TILE , PLACEMENT_ENEMY_PENGUIN , PLACEMENT_OWN_PENGUIN , PLACEMENT_MULTIPLE_FISH } |
| enum | PlacementSwitchError { PLACEMENT_ALL_PENGUINS_PLACED = -1 , PLACEMENT_NO_MORE_FREE_TILES = -2 } |
| Return values of placement_switch_player, must all be negative. More... | |
Functions | |
| void | placement_begin (Game *game) |
| Enters the GAME_PHASE_PLACEMENT phase, can only be called in GAME_PHASE_SETUP_DONE. More... | |
| void | placement_end (Game *game) |
| Exits the GAME_PHASE_PLACEMENT phase and switches to GAME_PHASE_SETUP_DONE. More... | |
| int | placement_switch_player (Game *game) |
| Performs the player switching logic for the placement phase. More... | |
| bool | any_valid_placement_exists (const Game *game) |
| bool | validate_placement_simple (const Game *game, Coords target) |
| PlacementError | validate_placement (const Game *game, Coords target) |
| void | place_penguin (Game *game, Coords target) |
| Creates a GameLogPlacement entry. The requested placement must be valid. More... | |
| void | undo_place_penguin (Game *game) |
| Removes a GameLogPlacement entry from the log and undoes it. More... | |
| enum PlacementError |
| Enumerator | |
|---|---|
| PLACEMENT_VALID | |
| PLACEMENT_OUT_OF_BOUNDS | |
| PLACEMENT_EMPTY_TILE | |
| PLACEMENT_ENEMY_PENGUIN | |
| PLACEMENT_OWN_PENGUIN | |
| PLACEMENT_MULTIPLE_FISH | |
Definition at line 14 of file placement.h.
| enum PlacementSwitchError |
Return values of placement_switch_player, must all be negative.
| Enumerator | |
|---|---|
| PLACEMENT_ALL_PENGUINS_PLACED | |
| PLACEMENT_NO_MORE_FREE_TILES | |
Definition at line 24 of file placement.h.
| void placement_begin | ( | Game * | game | ) |
Enters the GAME_PHASE_PLACEMENT phase, can only be called in GAME_PHASE_SETUP_DONE.
Definition at line 11 of file placement.c.
| void placement_end | ( | Game * | game | ) |
Exits the GAME_PHASE_PLACEMENT phase and switches to GAME_PHASE_SETUP_DONE.
Definition at line 20 of file placement.c.
| int placement_switch_player | ( | Game * | game | ) |
Performs the player switching logic for the placement phase.
Finds the next player who can make a placement, switches Game::current_player_index to that player and returns their index. If there are no more valid placements, returns a PlacementError value, which are all negative numbers.
Definition at line 32 of file placement.c.
| bool any_valid_placement_exists | ( | const Game * | game | ) |
Definition at line 51 of file placement.c.
Definition at line 64 of file placement.c.
Referenced by PlayerPlacementController::update_tile_attributes().
| PlacementError validate_placement | ( | const Game * | game, |
| Coords | target | ||
| ) |
Definition at line 70 of file placement.c.
Referenced by PlayerPlacementController::on_mouse_up(), and PlayerPlacementController::update_status_bar().
Creates a GameLogPlacement entry. The requested placement must be valid.
Definition at line 93 of file placement.c.
Referenced by BotPlacementThread::Entry(), and PlayerPlacementController::on_mouse_up().
| void undo_place_penguin | ( | Game * | game | ) |
Removes a GameLogPlacement entry from the log and undoes it.
Definition at line 115 of file placement.c.