diff options
Diffstat (limited to 'client/ui_errcatch.c')
-rw-r--r-- | client/ui_errcatch.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/client/ui_errcatch.c b/client/ui_errcatch.c new file mode 100644 index 0000000..d2c32b2 --- /dev/null +++ b/client/ui_errcatch.c @@ -0,0 +1,27 @@ +#include <stdlib.h> + +#include "errcatch.h" +#include "ui.h" + +char *w2_err_format(w2_s_error *error) { + char *ret_str = malloc(32); + sprintf(ret_str, "hai, 0x%02x", error->code); + return ret_str; +} + +void w2_ui_tab_errcatch(bool first) { + g_w2_ui_pad_body_scroll = 5 - g_w2_ui_height; + unsigned int line = 0; + for (unsigned int x = 0; x < W2_ERRCATCH_LOG_SIZE; x++) { + unsigned int i = (x + g_w2_error_log_index) % W2_ERRCATCH_LOG_SIZE; + if (g_w2_error_log[i] == NULL) continue; + + wmove(g_w2_ui_pad_body, line, 0); + char *err_str = w2_err_format(g_w2_error_log[i]); + waddstr(g_w2_ui_pad_body, err_str); + free(err_str); + + line++; + } + g_w2_ui_pad_body_scroll += line; +} |