summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-08 10:57:10 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2006-11-08 10:57:10 +0000
commit7f451cbd0fbcd54f465238e1ce5f43f83721c901 (patch)
treebdb05029b56761d7c1959e450cc2d54d978bc5b4
parentfe7815c7cb2e5e214d66c10b82f7b6543f8f7622 (diff)
downloadcrawl-ref-7f451cbd0fbcd54f465238e1ce5f43f83721c901.tar.gz
crawl-ref-7f451cbd0fbcd54f465238e1ce5f43f83721c901.zip
Fixed level-map brokenness when using the DEC character set on Linux.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup@364 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/initfile.cc2
-rw-r--r--crawl-ref/source/view.cc46
2 files changed, 34 insertions, 14 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index f95685b9f1..ce56d5b0fc 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -1289,7 +1289,7 @@ void parse_option_line(const std::string &str, bool runscript)
else if (key.find("cset") == 0)
{
std::string cset = key.substr(4);
- if (cset[0] == '_')
+ if (!cset.empty() && cset[0] == '_')
cset = cset.substr(1);
char_set_type cs = NUM_CSET;
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 2184acbf29..38bec13fb2 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -1803,6 +1803,29 @@ static int find_feature( const std::vector<coord_def>& features,
return 0;
}
+#ifdef USE_CURSES
+// NOTE: This affects libunix.cc draw state; use this just before setting
+// textcolour and drawing a character and call set_altcharset(false)
+// after you're done drawing.
+//
+static int cset_adjust(int raw)
+{
+ if (Options.char_set != CSET_ASCII)
+ {
+ // switch to alternate char set for 8-bit characters:
+ set_altcharset( raw > 127 );
+
+ // shift the DEC line drawing set:
+ if (Options.char_set == CSET_DEC
+ && raw >= 0xE0)
+ {
+ raw &= 0x7F;
+ }
+ }
+ return (raw);
+}
+#endif
+
// show_map() now centers the known map along x or y. This prevents
// the player from getting "artificial" location clues by using the
// map to see how close to the end they are. They'll need to explore
@@ -1976,12 +1999,20 @@ void show_map( FixedVector<int, 2> &spec_place, bool travel_mode )
if (i == 0 && j > 0)
gotoxy( 1, j + 1 );
+ int ch = buffer2[bufcount2 - 2];
+#ifdef USE_CURSES
+ ch = cset_adjust( ch );
+#endif
textcolor( buffer2[bufcount2 - 1] );
- putch( buffer2[bufcount2 - 2] );
+ putch(ch);
#endif
}
}
+#ifdef USE_CURSES
+ set_altcharset(false);
+#endif
+
#ifdef DOS_TERM
puttext(1, 1, 80, 25, buffer2);
#endif
@@ -3468,18 +3499,7 @@ void viewwindow(bool draw_it, bool do_updates)
for (count_x = 0; count_x < X_SIZE; count_x++)
{
#ifdef USE_CURSES
- if (Options.char_set != CSET_ASCII)
- {
- // switch to alternate char set for 8-bit characters:
- set_altcharset( (buffy[bufcount] > 127) );
-
- // shift the DEC line drawing set:
- if (Options.char_set == CSET_DEC
- && buffy[bufcount] >= 0xE0)
- {
- buffy[bufcount] &= 0x7F;
- }
- }
+ buffy[bufcount] = cset_adjust( buffy[bufcount] );
#endif
textcolor( buffy[bufcount + 1] );
putch( buffy[bufcount] );