diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-04-03 17:31:27 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-04-03 17:31:27 +0300 |
| commit | 0dd0adf9547758381573caa6a7d485415fafb33d (patch) | |
| tree | 06ed17c351d7adc6920d8bed6f3bdf87b8d958bd /path.c | |
| parent | 97decbee0dbc066db7ee94d0988ee26c1f8b35a8 (diff) | |
| download | astar-0dd0adf9547758381573caa6a7d485415fafb33d.tar.xz | |
Make map offsets global
Diffstat (limited to 'path.c')
| -rw-r--r-- | path.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -12,21 +12,19 @@ #include "error.h" #include "config.h" -/* TODO: somehow get offsets back to main */ /* TODO: make it move the map maybe to show the path */ /* TODO: figure out input when automatic = 1 */ int anim(Map map, size_t width, size_t height, Position start, Position end, Position *cur, char **visited, PositionPQ *frontier) { - static int offset_y = 0, offset_x = 0; static char automatic = 0; while (1) { - draw_map(map, width, height, offset_x, offset_y, start, end, cur, NULL, visited, frontier); - mvprintw(height+2 + offset_y, offset_x, "cur: %zu %zu", cur->x, cur->y); + draw_map(map, width, height, start, end, cur, NULL, visited, frontier); + mvprintw(height+2 + map_offset_y, map_offset_x, "cur: %zu %zu", cur->x, cur->y); if (automatic) { usleep(ANIM_DELAY_USEC); return 0; } switch (getch()) { - case 'h': offset_x -= 2; break; - case 'l': offset_x += 2; break; - case 'j': offset_y += 1; break; - case 'k': offset_y -= 1; break; + case 'h': map_offset_x -= 2; break; + case 'l': map_offset_x += 2; break; + case 'j': map_offset_y += 1; break; + case 'k': map_offset_y -= 1; break; case 'a': automatic = 1; break; case 'q': return -1; default: return 0; |
