diff options
author | scratko <m@scratko.xyz> | 2025-07-25 17:04:21 +0300 |
---|---|---|
committer | scratko <m@scratko.xyz> | 2025-07-25 17:46:22 +0300 |
commit | 90bd5ca05bea4dbeaaeff5cbe13b5671da420c82 (patch) | |
tree | 05757ed9b9ea0c007f4b4e86cfd8402fea4c6a5d /gameplay.cpp | |
parent | ac9a06b04144023e87d1a504cfe5598e7cf3d7b4 (diff) | |
download | picture-puzzle-90bd5ca05bea4dbeaaeff5cbe13b5671da420c82.tar.gz picture-puzzle-90bd5ca05bea4dbeaaeff5cbe13b5671da420c82.tar.bz2 picture-puzzle-90bd5ca05bea4dbeaaeff5cbe13b5671da420c82.zip |
Added const qualifiers is_next_to_empty_box() became visible to other files().
The size of the main window has been changed.
Checking whether the A* algorithm has been launched before starting a new game
or the same A* algorithm.
Fixed indentation in lambda expressions.
The initial node is added to open_queue without additional creation of dynamic
memory (the address of the object field is taken).
Fixed PQ_cont.erase().
IsNearEmptyBox was removed().
EqualNode moved to the Node class.
Diffstat (limited to 'gameplay.cpp')
-rw-r--r-- | gameplay.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gameplay.cpp b/gameplay.cpp index d6bf59f..0fcb39c 100644 --- a/gameplay.cpp +++ b/gameplay.cpp @@ -7,8 +7,8 @@ #include <memory> #include <vector> -static bool is_next_to_empty_box(GameParams::coordinates empty_box_pos, - GameParams::coordinates current_pos) +bool is_next_to_empty_box(GameParams::coordinates empty_box_pos, + GameParams::coordinates current_pos) { return (current_pos.x - spacing - puzzle_size == empty_box_pos.x && @@ -30,7 +30,7 @@ static bool is_coordinate_match(GameParams::coordinates& first, bool PuzzleGame::IsFinalPlacement(GameParams *gp) { bool is_match = 1; - auto lambda = [gp, &is_match](std::unique_ptr<Puzzle>& next_puzzle) { + auto lambda = [gp, &is_match](const std::unique_ptr<Puzzle>& next_puzzle) { GameParams::coordinates pos_next_puzzle = { next_puzzle->x(), next_puzzle->y() }; GameParams::coordinates target_pos = |