diff --git a/.cache/clangd/index/cavegen.c.31C36C571011BBE3.idx b/.cache/clangd/index/cavegen.c.31C36C571011BBE3.idx new file mode 100644 index 0000000..a11359f Binary files /dev/null and b/.cache/clangd/index/cavegen.c.31C36C571011BBE3.idx differ diff --git a/.cache/clangd/index/cavegen.h.E2678233C4D685BB.idx b/.cache/clangd/index/cavegen.h.E2678233C4D685BB.idx new file mode 100644 index 0000000..3c216e6 Binary files /dev/null and b/.cache/clangd/index/cavegen.h.E2678233C4D685BB.idx differ diff --git a/.cache/clangd/index/common.h.62D878C53FCF5453.idx b/.cache/clangd/index/common.h.62D878C53FCF5453.idx new file mode 100644 index 0000000..1bb8397 Binary files /dev/null and b/.cache/clangd/index/common.h.62D878C53FCF5453.idx differ diff --git a/.cache/clangd/index/display.c.7FAC180B80A66DEC.idx b/.cache/clangd/index/display.c.7FAC180B80A66DEC.idx new file mode 100644 index 0000000..7ef3d5f Binary files /dev/null and b/.cache/clangd/index/display.c.7FAC180B80A66DEC.idx differ diff --git a/.cache/clangd/index/display.h.14F74A4A3285599B.idx b/.cache/clangd/index/display.h.14F74A4A3285599B.idx new file mode 100644 index 0000000..e038903 Binary files /dev/null and b/.cache/clangd/index/display.h.14F74A4A3285599B.idx differ diff --git a/.cache/clangd/index/entity.h.3B6FA0ECB38E3A2B.idx b/.cache/clangd/index/entity.h.3B6FA0ECB38E3A2B.idx new file mode 100644 index 0000000..705bcb2 Binary files /dev/null and b/.cache/clangd/index/entity.h.3B6FA0ECB38E3A2B.idx differ diff --git a/.cache/clangd/index/ht.c.473DB230E35C76F1.idx b/.cache/clangd/index/ht.c.473DB230E35C76F1.idx new file mode 100644 index 0000000..44e7dfd Binary files /dev/null and b/.cache/clangd/index/ht.c.473DB230E35C76F1.idx differ diff --git a/.cache/clangd/index/ht.h.6FF09F553AA22C09.idx b/.cache/clangd/index/ht.h.6FF09F553AA22C09.idx new file mode 100644 index 0000000..1cbfb5e Binary files /dev/null and b/.cache/clangd/index/ht.h.6FF09F553AA22C09.idx differ diff --git a/.cache/clangd/index/main.c.0EAB2510BE9DFF6B.idx b/.cache/clangd/index/main.c.0EAB2510BE9DFF6B.idx new file mode 100644 index 0000000..6a40992 Binary files /dev/null and b/.cache/clangd/index/main.c.0EAB2510BE9DFF6B.idx differ diff --git a/ht.c b/ht.c new file mode 100644 index 0000000..d674af2 --- /dev/null +++ b/ht.c @@ -0,0 +1 @@ +#include "ht.h" diff --git a/include/display.h b/include/display.h index c4f5249..d9c66bb 100644 --- a/include/display.h +++ b/include/display.h @@ -30,11 +30,14 @@ enum action { NUM_ACTIONS, }; -display_t *display_init(void); -void display_map(display_t *disp, struct map *map, ht_t *entities); -void display_instructions(display_t *disp); -void display_message(display_t *disp, char *msg); -void display_status(display_t *disp, struct entity *entity); +display_t *display_init(void); +void display_destroy(display_t *disp); + +void display_map(display_t *disp, struct map *map, ht_t *entities); +void display_instructions(display_t *disp); +void display_message(display_t *disp, char *msg); +void display_status(display_t *disp, struct entity *entity); + enum action display_process_input(void); #endif // DISPLAY_H_ diff --git a/main.c b/main.c index 2d1e6c0..086a093 100644 --- a/main.c +++ b/main.c @@ -138,6 +138,7 @@ int main(void) free(map.map); ht_destroy(entities); + display_destroy(disp); endwin(); diff --git a/src/display.c b/src/display.c index 0b08390..cc0a06b 100644 --- a/src/display.c +++ b/src/display.c @@ -89,6 +89,16 @@ display_t *display_init(void) return create_windows(); } +void display_destroy(display_t *disp) +{ + delwin(disp->main); + delwin(disp->inst); + delwin(disp->msgs); + delwin(disp->stat); + + free(disp); +} + void display_map(display_t *disp, struct map *map, ht_t *entities) { // print map diff --git a/src/ht.c b/src/ht.c index 39093eb..f44ea12 100644 --- a/src/ht.c +++ b/src/ht.c @@ -4,8 +4,6 @@ #include #include -#define SIZE 1024 - struct node { char *key; void *val; @@ -56,6 +54,8 @@ static void rehash(ht_t *h, int newsize) h->curr_index = 0; h->curr_node = NULL; h->iterating = false; + + free(new_h); } static unsigned long djb2_hash(char *str)