From 9ff367c1410daee974c2a9619485c7d41d2ac6f8 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Thu, 26 Nov 2009 17:16:08 +0100 Subject: Simplify scrolling handling in message_out. The newline parameter to message_out is gone. Instead, a pointer to the message line is passed which may lie outside the message window. The window is then scrolled to make that line the last line. This also updates libnonunix.cc, but I haven't been able to test those changes. --- crawl-ref/source/libdos.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/libdos.cc') diff --git a/crawl-ref/source/libdos.cc b/crawl-ref/source/libdos.cc index 62e90ae93d..f20d809fd6 100644 --- a/crawl-ref/source/libdos.cc +++ b/crawl-ref/source/libdos.cc @@ -57,20 +57,22 @@ static void scroll_message_window() cgotoxy(x, y - 1); } -void message_out(int which_line, int colour, const char *s, int firstcol, - bool newline) +void message_out(int *which_line, int colour, const char *s, int firstcol) { if (!firstcol) firstcol = Options.delay_message_clear? 2 : 1; + while (*which_line > crawl_view.msgsz.y - 1) + { + scroll_message_window(); + (*which_line)--; + } + cgotoxy(firstcol + crawl_view.msgp.x - 1, which_line + crawl_view.msgp.y); textcolor(colour); cprintf("%s", s); - - if (newline && which_line == crawl_view.msgsz.y - 1) - scroll_message_window(); } void set_cursor_enabled(bool enabled) -- cgit v1.2.3-54-g00ecf