diff options
| -rw-r--r-- | main.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -70,6 +70,7 @@ int main(int argc, char **argv) { char is_maze = 0; char bmp_only = 0; char *bmp_filename = NULL; + char pathfind_on_start = 1; char anim = 0; int dirs = 8; @@ -79,16 +80,18 @@ int main(int argc, char **argv) { * Currently supported: * -a to animate the pathfinding (get input after each step) * -d for Dijkstra + * -n to not pathfind on start * -m {width}x{height} to give a maze of given size * -f {filename} to load a map from the filename * -b {filename} to just generate a bitmap, no interface * -4 for four directions * -8 for eight directions */ int opt; - while ((opt = getopt(argc, argv, ":adm:f:b:48")) != -1) { + while ((opt = getopt(argc, argv, ":adnm:f:b:48")) != -1) { switch (opt) { case 'a': anim = 1; break; case 'd': path_func = &dijkstra_path; break; + case 'n': pathfind_on_start = 0; break; case 'm': if (sscanf(optarg, "%zux%zu", &mwidth, &mheight) != 2) error("Wrong maze size string in argument\n"); is_maze = 1; @@ -138,7 +141,8 @@ int main(int argc, char **argv) { char **visited = visited_new(width, height); Path path = NULL; - path = path_func(dirs, map, cell_costs, width, height, start_pos, end_pos, visited, anim); + if (pathfind_on_start) + path = path_func(dirs, map, cell_costs, width, height, start_pos, end_pos, visited, anim); if (bmp_only) { map_to_bmp(map, width, height, start_pos, end_pos, path, visited, bmp_filename); |
