penguins  1.0.0
placement.c File Reference

Go to the source code of this file.

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...
 

Function Documentation

◆ placement_begin()

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.

◆ placement_end()

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.

◆ placement_switch_player()

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.

◆ any_valid_placement_exists()

bool any_valid_placement_exists ( const Game game)

Definition at line 51 of file placement.c.

◆ validate_placement_simple()

bool validate_placement_simple ( const Game game,
Coords  target 
)

Definition at line 64 of file placement.c.

Referenced by PlayerPlacementController::update_tile_attributes().

◆ validate_placement()

PlacementError validate_placement ( const Game game,
Coords  target 
)

◆ place_penguin()

void place_penguin ( Game game,
Coords  target 
)

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().

◆ undo_place_penguin()

void undo_place_penguin ( Game game)

Removes a GameLogPlacement entry from the log and undoes it.

Definition at line 115 of file placement.c.