summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/libdos.h8
-rw-r--r--crawl-ref/source/libunix.cc11
-rw-r--r--crawl-ref/source/libunix.h1
-rw-r--r--crawl-ref/source/libw32c.h6
-rw-r--r--crawl-ref/source/view.cc5
5 files changed, 26 insertions, 5 deletions
diff --git a/crawl-ref/source/libdos.h b/crawl-ref/source/libdos.h
index bbf8720009..e5df42f779 100644
--- a/crawl-ref/source/libdos.h
+++ b/crawl-ref/source/libdos.h
@@ -1,6 +1,8 @@
#ifndef __LIBDOS_H__
#define __LIBDOS_H__
+#include <conio.h>
+
typedef unsigned char screen_buffer_t;
void init_libdos();
@@ -25,4 +27,10 @@ inline void update_screen()
void putwch(unsigned c);
+inline void put_colour_ch(int colour, unsigned ch)
+{
+ textattr(colour);
+ putwch(ch);
+}
+
#endif
diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc
index 0792189fd0..ba28a4039c 100644
--- a/crawl-ref/source/libunix.cc
+++ b/crawl-ref/source/libunix.cc
@@ -600,7 +600,7 @@ int window(int x1, int y1, int x2, int y2)
// textcolour and drawing a character and call set_altcharset(false)
// after you're done drawing.
//
-int cset_adjust(int raw)
+unsigned cset_adjust(unsigned raw)
{
if (Options.char_set != CSET_ASCII && Options.char_set != CSET_UNICODE)
{
@@ -617,6 +617,13 @@ int cset_adjust(int raw)
return (raw);
}
+void put_colour_ch(int colour, unsigned ch)
+{
+ ch = cset_adjust(ch);
+ textattr(colour);
+ putwch(ch);
+}
+
void puttext(int x1, int y1, int x2, int y2, const screen_buffer_t *buf)
{
const bool will_scroll = (x2 == get_number_of_cols());
@@ -635,7 +642,6 @@ void puttext(int x1, int y1, int x2, int y2, const screen_buffer_t *buf)
buf += 2;
}
}
- set_altcharset(false);
update_screen();
if (will_scroll)
@@ -649,6 +655,7 @@ void puttext(int x1, int y1, int x2, int y2, const screen_buffer_t *buf)
// C++ string class. -- bwr
void update_screen(void)
{
+ set_altcharset(false);
refresh();
}
diff --git a/crawl-ref/source/libunix.h b/crawl-ref/source/libunix.h
index ee424433df..ef28a84ac1 100644
--- a/crawl-ref/source/libunix.h
+++ b/crawl-ref/source/libunix.h
@@ -31,6 +31,7 @@ int itoa(int value, char *strptr, int radix);
int kbhit(void);
int putch(unsigned char chr);
int putwch(unsigned chr);
+void put_colour_ch(int colour, unsigned ch);
int stricmp(const char *str1, const char *str2);
int translate_keypad(int keyin);
int wherex(void);
diff --git a/crawl-ref/source/libw32c.h b/crawl-ref/source/libw32c.h
index 09ccbb906b..46146a920b 100644
--- a/crawl-ref/source/libw32c.h
+++ b/crawl-ref/source/libw32c.h
@@ -54,4 +54,10 @@ void enable_smart_cursor(bool cursor);
bool is_smart_cursor_enabled();
void set_mouse_enabled(bool enabled);
+inline void put_colour_ch(int colour, unsigned ch)
+{
+ textattr(colour);
+ putwch(ch);
+}
+
#endif
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 83caf64dc3..66fa9d8143 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -4190,10 +4190,9 @@ void view_update_at(const coord_def &pos)
int flash_colour = you.flash_colour;
if (flash_colour == BLACK)
flash_colour = viewmap_flash_colour();
-
+
gotoxy(vp.x, vp.y);
- textattr(flash_colour? real_colour(flash_colour) : colour);
- putwch(ch);
+ put_colour_ch(flash_colour? real_colour(flash_colour) : colour, ch);
// Force colour back to normal, else clrscr() will flood screen
// with this colour on DOS.