From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 5 Sep 2015 00:12:40 +0000 (+0200)
Subject: Client: Fix log window drawing bug (too small winmap allocated).
X-Git-Tag: tce~291
X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/pick_tasks?a=commitdiff_plain;h=bbd7e671ba66fcbdefef7d959a70948c301536a3;p=plomrogue
Client: Fix log window drawing bug (too small winmap allocated).
---
diff --git a/TODO b/TODO
index c0428f7..212f582 100644
--- a/TODO
+++ b/TODO
@@ -20,3 +20,5 @@ CLIENT:
- re-work unnecessary complex command / keybinding / server message mapping
- only send "ITEM_HERE" query to server when the dependent window is open
+
+- draw_win_log() is still buggy (make mem alloc for other line break styles!)
diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c
index 9857af5..e409d87 100644
--- a/src/client/draw_wins.c
+++ b/src/client/draw_wins.c
@@ -361,7 +361,7 @@ extern void draw_win_log(struct Win * win)
if (x > win->frame_size.x || '\n' == world.log[i])
{
n_postbreak_lines++;
- x = 0;
+ x = 1;
}
}
if (n_postbreak_lines > win->frame_size.y)
@@ -369,6 +369,7 @@ extern void draw_win_log(struct Win * win)
uint32_t size = n_postbreak_lines * (win->frame_size.x + 1);
win->winmap = try_malloc(sizeof(chtype) * size, __func__);
for (i = 0; i < size; win->winmap[i] = ' ', i++);
+ /* TODO: This should only be done with "long" line break style. */
do_realloc_winmap = 0;
draw_text_from_bottom(win, world.log);
do_realloc_winmap = 1;