aboutsummaryrefslogtreecommitdiff
path: root/map.h
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-04-14 18:25:30 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-04-14 18:25:30 +0300
commitf0b6bb6974c823c4b5a7deffce0748f2ff6370de (patch)
tree37ccd97ce0f10959006740ed4949d95b903a2f2f /map.h
parentc8d863b4b37a64f1df3cd4c25e6367949f2e6650 (diff)
downloadastar-f0b6bb6974c823c4b5a7deffce0748f2ff6370de.tar.xz
Change how messages are written, clean up differently
Diffstat (limited to 'map.h')
-rw-r--r--map.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/map.h b/map.h
index b2b3ff4..23a8773 100644
--- a/map.h
+++ b/map.h
@@ -3,16 +3,16 @@
#include <stddef.h>
#include "structs.h"
+#include "config.h"
#include "path.h"
#include "priority_queue.h"
-/* Prints a message at the line right below the map. Multiline messages are undefined behaviour */
-#define message(height, ...) { \
- if (move((height) + map_offset_y + 1, map_offset_x - 2) != ERR) { clrtoeol(); /* Clear the line */\
- mvprintw((height) + map_offset_y + 1, map_offset_x - 2, __VA_ARGS__); }}
-
extern int map_offset_x;
extern int map_offset_y;
+extern char message[MESSAGE_MAX_SIZE];
+
+#define set_message(...) snprintf(message, MESSAGE_MAX_SIZE, __VA_ARGS__);
+#define clear_message() message[0] = 0;
/* Returns an empty map of given size */
Map empty_map(size_t width, size_t height);
@@ -53,6 +53,8 @@ void map_to_file_plaintext(char *filename, Map map, size_t width, size_t height,
* path could be NULL to draw a map with no path. So can cursor, frontier and visited */
void draw_map(Map map, size_t width, size_t height, Position start, Position goal, Position *cursor, Path path, char **visited, PositionPQ *frontier);
+void print_message(size_t height);
+
/* Frees all the memory reserved for the map */
void map_free(Map map, size_t height);