diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -176,7 +176,15 @@ int main(int argc, char **argv) { } break; - case 'a': anim = !anim; break; + case 'a': + /* Only animate if there was already a path, otherwise just calculate one */ + if (path == NULL) anim = 0; + else anim = 1; + + path_free(path, height); + path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + clear_message(); + break; case 'd': if (path_func == astar_path) { set_message("Dijkstra"); path_func = &dijkstra_path; } |
