mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 20:17:58 -04:00
empty messages clear the whole widget
This commit is contained in:
parent
4e0bccdf53
commit
629c1662a4
10
src/hu_lib.c
10
src/hu_lib.c
@ -86,6 +86,16 @@ void HUlib_clear_cur_line (hu_multiline_t *const m)
|
||||
HUlib_clear_line(m->lines[m->curline]);
|
||||
}
|
||||
|
||||
void HUlib_clear_all_lines (hu_multiline_t *const m)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m->numlines; i++)
|
||||
{
|
||||
HUlib_clear_line(m->lines[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// [FG] add single char to line, increasing its length but not its width
|
||||
|
||||
static boolean add_char_to_line(hu_line_t *const t, const char ch)
|
||||
|
@ -122,6 +122,7 @@ void HUlib_reset_align_offsets (void);
|
||||
|
||||
void HUlib_clear_line (hu_line_t *const l);
|
||||
void HUlib_clear_cur_line (hu_multiline_t *const m);
|
||||
void HUlib_clear_all_lines (hu_multiline_t *const m);
|
||||
|
||||
void HUlib_add_string_to_cur_line (hu_multiline_t *const m, const char *s);
|
||||
void HUlib_add_strings_to_cur_line (hu_multiline_t *const m, const char *prefix, const char *s);
|
||||
|
@ -580,6 +580,8 @@ void HU_Start(void)
|
||||
HUlib_init_multiline(&w_message, message_list ? hud_msg_lines : 1,
|
||||
&doom_font, colrngs[hudcolor_mesg],
|
||||
&message_on, NULL);
|
||||
// [FG] clear messages
|
||||
HUlib_clear_all_lines(&w_message);
|
||||
|
||||
// create the secret message widget
|
||||
HUlib_init_multiline(&w_secret, 1,
|
||||
@ -1532,6 +1534,10 @@ void HU_Ticker(void)
|
||||
//post the message to the message widget
|
||||
HUlib_add_string_to_cur_line(&w_message, plr->message);
|
||||
|
||||
// [FG] empty messages clear the whole widget
|
||||
if (plr->message[0] == '\0')
|
||||
HUlib_clear_all_lines(&w_message);
|
||||
|
||||
// clear the message to avoid posting multiple times
|
||||
plr->message = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user