summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libw32c.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-09-07 14:04:45 +0200
committerAdam Borowski <kilobyte@angband.pl>2011-09-07 14:04:45 +0200
commiteeb062edcdea166aa2a90874f272a440b7fa9941 (patch)
tree8fb33721c4090ee55788c3963ba98e7f3e25d084 /crawl-ref/source/libw32c.cc
parentf99166ed9de3901010fe6544640203d690b79776 (diff)
downloadcrawl-ref-eeb062edcdea166aa2a90874f272a440b7fa9941.tar.gz
crawl-ref-eeb062edcdea166aa2a90874f272a440b7fa9941.zip
Catch attempts to print out a character >U+FFFF on Windows.
Diffstat (limited to 'crawl-ref/source/libw32c.cc')
-rw-r--r--crawl-ref/source/libw32c.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc
index 8a70e5927d..a412a524f6 100644
--- a/crawl-ref/source/libw32c.cc
+++ b/crawl-ref/source/libw32c.cc
@@ -95,7 +95,7 @@ static bool w32_smart_cursor = true;
// we can do straight translation of DOS color to win32 console color.
#define WIN32COLOR(col) (WORD)(col)
-static void writeChar(wchar_t c);
+static void writeChar(ucs_t c);
static void bFlush(void);
static void _setcursortype_internal(bool curstype);
@@ -123,7 +123,7 @@ static DWORD crawlColorData[16] =
};
*/
-void writeChar(wchar_t c)
+void writeChar(ucs_t c)
{
if (c == '\t')
{
@@ -151,6 +151,10 @@ void writeChar(wchar_t c)
return;
}
+ // check for upper Unicode which Windows can't handle
+ if (c > 0xFFFF)
+ c = 0xBF; // '¿'
+
int tc = WIN32COLOR(current_color);
pci = &screen[SCREENINDEX(cx,cy)];
@@ -598,7 +602,7 @@ int wherey(void)
return cy+1;
}
-void putwch(wchar_t c)
+void putwch(ucs_t c)
{
if (c == 0)
c = ' ';