Mercurial > molko
changeset 397:73eabfd50410
rpg: do the same for message
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 18 Feb 2022 16:16:38 +0100 |
parents | c9769a77ad8c |
children | 14ce7c4871e3 |
files | src/libmlk-rpg/rpg/message.c |
diffstat | 1 files changed, 7 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/libmlk-rpg/rpg/message.c Fri Feb 18 16:14:06 2022 +0100 +++ b/src/libmlk-rpg/rpg/message.c Fri Feb 18 16:16:38 2022 +0100 @@ -112,25 +112,19 @@ static void draw_lines(const struct message *msg) { - struct theme theme; + const struct theme *theme = THEME(msg); struct label label; unsigned int lw, lh; - /* - * We need a copy of the current theme because we will alter the label - * color depending on the selection. - */ - theme_shallow(&theme, THEME(msg)); - for (size_t i = 0; i < msg->linesz; ++i) { if (!msg->lines[i]) continue; - if (font_query(theme.fonts[THEME_FONT_INTERFACE], msg->lines[i], &lw, &lh) < 0) + if (font_query(theme->fonts[THEME_FONT_INTERFACE], msg->lines[i], &lw, &lh) < 0) panic(); - label.theme = &theme; - label.x = theme.padding; - label.y = theme.padding + (i * (lh + msg->spacing)); + label.theme = theme; + label.x = theme->padding; + label.y = theme->padding + (i * (lh + msg->spacing)); label.text = msg->lines[i]; label.flags = LABEL_FLAGS_SHADOW; @@ -145,9 +139,9 @@ * we need to cheat the normal color. */ if (msg->flags & MESSAGE_FLAGS_QUESTION && msg->index == (unsigned int)i) - theme.colors[THEME_COLOR_NORMAL] = THEME(msg)->colors[THEME_COLOR_SELECTED]; + label.flags |= LABEL_FLAGS_SELECTED; else - theme.colors[THEME_COLOR_NORMAL] = THEME(msg)->colors[THEME_COLOR_NORMAL]; + label.flags &= ~(LABEL_FLAGS_SELECTED); label_draw(&label); }