penguins
1.0.0
|
Go to the source code of this file.
Functions | |
void | setup_board (Game *game, int width, int height) |
Sets Game::board_width and Game::board_height and allocates Game::board_grid and Game::tile_attributes. Can only be called within GAME_PHASE_SETUP. The width and height values must be positive. More... | |
void | generate_board_random (Game *game, Rng *rng) |
Generates the board by setting every tile purely randomly. The resulting board will look sort of like a maze. More... | |
void | generate_board_island (Game *game, Rng *rng) |
Generates the board which looks sort of like a big icy island. More... | |
Functions for accessing the board tiles and attributes | |
All of these are inline because they are used very very frequently in virtually every module of the app, thus in computation-heavy code, such as the bot, inlining those functions enables very efficient optimizations by the compiler (the bot in particular has been sped up 2 times). | |
bool | is_tile_in_bounds (const Game *game, Coords coords) |
Checks if the given coords are within the bounds of the board. More... | |
bool | get_tile_attr (const Game *game, Coords coords, short attr) |
Checks whether the attribute attr of the tile at coords is set. More... | |
void | set_tile_attr (Game *game, Coords coords, short attr, bool value) |
Sets (or resets) the attribute attr of the tile at coords . More... | |
void | set_all_tiles_attr (Game *game, short attr, bool value) |
Sets the attribute attr on all tiles. More... | |
short | get_tile (const Game *game, Coords coords) |
Returns the value of the tile at coords . Fails if coords are outside the bounds. More... | |
void | set_tile (Game *game, Coords coords, short value) |
Sets the value of the tile at coords (and also sets the attribute TILE_DIRTY). Fails if coords are outside the bounds. More... | |
void setup_board | ( | Game * | game, |
int | width, | ||
int | height | ||
) |
Sets Game::board_width and Game::board_height and allocates Game::board_grid and Game::tile_attributes. Can only be called within GAME_PHASE_SETUP. The width
and height
values must be positive.
Definition at line 12 of file board.c.
Referenced by GamePanel::GamePanel().
Generates the board by setting every tile purely randomly. The resulting board will look sort of like a maze.
Definition at line 26 of file board.c.
Referenced by GamePanel::GamePanel(), run_autonomous_mode(), and run_interactive_mode().
Generates the board which looks sort of like a big icy island.
Definition at line 37 of file board.c.
Referenced by GamePanel::GamePanel(), and run_autonomous_mode().
|
inline |
Checks if the given coords
are within the bounds of the board.
Definition at line 70 of file board.h.
Referenced by CanvasPanel::get_selected_penguin_coords(), PlayerMovementController::on_mouse_move(), PlayerPlacementController::on_mouse_up(), PlayerMovementController::on_mouse_up(), CanvasPanel::on_paint(), CanvasPanel::paint_board(), PlayerTurnController::paint_overlay(), PlayerMovementController::paint_overlay(), CanvasPanel::paint_tiles(), PlayerPlacementController::update_status_bar(), PlayerMovementController::update_status_bar(), PlayerPlacementController::update_tile_attributes(), and PlayerMovementController::update_tile_attributes().
|
inline |
Checks whether the attribute attr
of the tile at coords
is set.
Definition at line 78 of file board.h.
Referenced by CanvasPanel::on_paint(), CanvasPanel::paint_board(), PlayerTurnController::paint_overlay(), and CanvasPanel::paint_tiles().
|
inline |
Sets (or resets) the attribute attr
of the tile at coords
.
Definition at line 86 of file board.h.
Referenced by PlayerMovementController::on_mouse_move(), CanvasPanel::on_paint(), CanvasPanel::paint_board(), CanvasPanel::paint_tiles(), PlayerPlacementController::update_tile_attributes(), and PlayerMovementController::update_tile_attributes().
|
inline |
Sets the attribute attr
on all tiles.
Definition at line 95 of file board.h.
Referenced by GameController::update_tile_attributes(), PlayerMovementController::update_tile_attributes(), and BotTurnController::update_tile_attributes().
|
inline |
Returns the value of the tile at coords
. Fails if coords
are outside the bounds.
Definition at line 108 of file board.h.
Referenced by GamePanel::GamePanel(), CanvasPanel::get_selected_penguin_coords(), CanvasPanel::paint_board(), CanvasPanel::paint_tiles(), PlayerMovementController::update_status_bar(), and PlayerMovementController::update_tile_attributes().
|
inline |
Sets the value of the tile at coords
(and also sets the attribute TILE_DIRTY). Fails if coords
are outside the bounds.