back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/ghosts.c
diff options
context:
space:
mode:
authorscratko <m@scratko.xyz>2024-04-12 16:33:07 +0300
committerscratko <m@scratko.xyz>2024-04-12 16:33:07 +0300
commit91583d5699503e981105beecc51d37b59dc1842e (patch)
treecce70cc6ff3b045d3f0997727add1fb83af2a382 /ghosts.c
parent04a6703fd66a7d34b2556a9c203c4dada3baca38 (diff)
downloadpacman-91583d5699503e981105beecc51d37b59dc1842e.tar.gz
pacman-91583d5699503e981105beecc51d37b59dc1842e.tar.bz2
pacman-91583d5699503e981105beecc51d37b59dc1842e.zip
Coin checks
Coin checks in yellow blocks and stars. Fixed arguments of find_free_directions function.
Diffstat (limited to 'ghosts.c')
-rw-r--r--ghosts.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ghosts.c b/ghosts.c
index ded74e7..f8edfa2 100644
--- a/ghosts.c
+++ b/ghosts.c
@@ -116,8 +116,8 @@ void make_ghost_moves(game_space field,
static void pave_only_way(game_space field, struct ghost_type *ghost)
{
- struct free_directions path = find_free_directions(field, ghost->position.y,
- ghost->position.x);
+ struct free_directions path = find_free_directions(field, ghost->position.x,
+ ghost->position.y);
enum movement_direction reverse_direction = ghost->direction;
reverse_direction ^= 1;
if(path.left && left != reverse_direction)
@@ -344,7 +344,7 @@ void compute_distance_between_points(game_space field,
initial_point = ghost->position;
min_distance = 0;
struct free_directions consider_paths =
- find_free_directions(field, initial_point.y, initial_point.x);
+ find_free_directions(field, initial_point.x, initial_point.y);
if(consider_paths.right && ghost_direction != left) {
changed_initial_point.x = initial_point.x + 1;
changed_initial_point.y = initial_point.y;
@@ -399,7 +399,7 @@ void random_redirect(game_space field, struct ghost_type *ghost)
{
enum movement_direction random_direction;
struct free_directions paths =
- find_free_directions(field, ghost->position.y, ghost->position.x);
+ find_free_directions(field, ghost->position.x, ghost->position.y);
random_direction = get_random_direction();
while(!is_equal_directions(random_direction, paths))
random_direction = get_random_direction();