fix: possible infinite loop when pathfinding
This commit is contained in:
parent
06134ea31c
commit
bee91cfd7c
1 changed files with 2 additions and 1 deletions
|
@ -6,7 +6,7 @@
|
||||||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/04/10 18:19:19 by mcolonna #+# #+# */
|
/* Created: 2024/04/10 18:19:19 by mcolonna #+# #+# */
|
||||||
/* Updated: 2024/04/18 16:03:05 by mcolonna ### ########.fr */
|
/* Updated: 2024/04/19 17:32:16 by mcolonna ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ t_direction pathfinding(t_point start, t_point finish, bool for_firsk)
|
||||||
map = init_map(env.mc, for_firsk);
|
map = init_map(env.mc, for_firsk);
|
||||||
tocheck = inittochecklist(env.mc, map.dim, start);
|
tocheck = inittochecklist(env.mc, map.dim, start);
|
||||||
case_checking = start;
|
case_checking = start;
|
||||||
|
((t_path_map_case *)*map_at(&map, start))->to_check = true;
|
||||||
while (case_checking.x != -1 || case_checking.y != -1)
|
while (case_checking.x != -1 || case_checking.y != -1)
|
||||||
{
|
{
|
||||||
r = pathfinding_checkdirections(&tocheck, case_checking, &map, env);
|
r = pathfinding_checkdirections(&tocheck, case_checking, &map, env);
|
||||||
|
|
Loading…
Add table
Reference in a new issue