aboutsummaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-04-05 10:51:41 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-04-05 10:51:41 +0300
commit3800654c56fc598bffda5b93fbe9dc7f88896fc2 (patch)
treeb4801f51fc980ecf0af98528e330b4dcae189a77 /map.c
parent81c2e4ceed1da913d6137f7d3fd8af1ddf9faedc (diff)
downloadastar-3800654c56fc598bffda5b93fbe9dc7f88896fc2.tar.xz
Fix a rendering bug
Diffstat (limited to 'map.c')
-rw-r--r--map.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/map.c b/map.c
index a433dc0..cbfe333 100644
--- a/map.c
+++ b/map.c
@@ -220,8 +220,9 @@ Map file_plaintext_map(char *filename, size_t *width, size_t *height, Position *
/* FIXME: clean up better maybe idk. There's a bug where parts of path may not be rendered if goal slightly above start in an empty area */
/* FIXME: yeah there are plenty of bugs. the path just doesn't get rendered correctrly at times, even if it's calculated just fine. AND IT's SPECIFICALLY AFTER map_editor() WHAT IN THE ACTUAL FUCK AAAAAAAAAAAAAAAAAAAAAAAAAAAAA*/
void draw_map(Map map, size_t width, size_t height, Position start, Position goal, Position *cursor, Path path, char **visited, PositionPQ *frontier) {
- /* I think it flickers less when we do that */
- wnoutrefresh(stdscr);
+ /* I think it flickers less when we do that
+ * UPD: it was causing a bug, so I commented it out. I don't know why either */
+ //wnoutrefresh(stdscr);
/* Clean up the area around the map */
for (ssize_t i = -1; i <= (ssize_t)(width*2 + 4); i++) { /* Horizontal */
@@ -254,7 +255,7 @@ void draw_map(Map map, size_t width, size_t height, Position start, Position goa
/* Draw field */
if (map != NULL) {
- char c; /* The char for the current tile */
+ char c = '\0'; /* The char for the current tile */
for (size_t i = 0; i < height; i++) {
for (size_t j = 0; j < width; j++) {
int color_pair = 0; /* The color pair of the current char */
@@ -372,7 +373,8 @@ void draw_map(Map map, size_t width, size_t height, Position start, Position goa
}
attroff(A_BOLD);
- doupdate();
+ /* Read the comment at the start of this function */
+ //doupdate();
}
void map_free(Map map, size_t height) {
@@ -396,6 +398,7 @@ void print_map_out(Map map, size_t width, size_t height) {
}
void map_editor(Map *map, size_t *width, size_t *height, Position *start, Position *goal) {
+ clear();
draw_map(*map, *width, *height, *start, *goal, NULL, NULL, NULL, NULL);
mvprintw(*height + map_offset_y + 1, map_offset_x - 2, "You've entered the map editor. 'q' to quit");