diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-04-14 18:50:25 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-04-14 18:50:25 +0300 |
| commit | fe2e095a4a331bc284e857d8fcc6babc84ab09f3 (patch) | |
| tree | f505af602ef34f540e339007543e28c9b1df07a3 /main.c | |
| parent | 7f45a02a1383da0f0a0e72d61388e1e07974a6e3 (diff) | |
| download | astar-fe2e095a4a331bc284e857d8fcc6babc84ab09f3.tar.xz | |
Some anim() shit
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; } |
