summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnne Walker <ennewalker@users.sourceforge.net>2010-01-03 16:56:13 -0500
committerEnne Walker <ennewalker@users.sourceforge.net>2010-01-03 16:59:23 -0500
commit4294ce7ebf7350f3d26dbe5350337aa9378d6797 (patch)
tree9937ace8f22f988356a970188a2c044f7e5f2d9d
parent49840080f1506e463f49fe21f380c4810a3b4ad1 (diff)
downloadcrawl-ref-4294ce7ebf7350f3d26dbe5350337aa9378d6797.tar.gz
crawl-ref-4294ce7ebf7350f3d26dbe5350337aa9378d6797.zip
[212] Fixing prompts clearing screen in tiles.
The line reader was always switching back to GOTO_CRT. When receiving input from the message window, this ended up causing the screen to blank and switch to the CRT layer. Adding a function get the current cursor region allows the line reader to not change regions.
-rw-r--r--crawl-ref/source/cio.cc2
-rw-r--r--crawl-ref/source/libgui.cc5
-rw-r--r--crawl-ref/source/libgui.h1
-rw-r--r--crawl-ref/source/libutil.cc9
-rw-r--r--crawl-ref/source/libutil.h1
-rw-r--r--crawl-ref/source/tilesdl.cc13
-rw-r--r--crawl-ref/source/tilesdl.h1
7 files changed, 31 insertions, 1 deletions
diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc
index 9c7a705c57..370492536b 100644
--- a/crawl-ref/source/cio.cc
+++ b/crawl-ref/source/cio.cc
@@ -401,7 +401,7 @@ void line_reader::cursorto(int ncx)
{
int x = (start_x + ncx - 1) % wrapcol + 1;
int y = start_y + (start_x + ncx - 1) / wrapcol;
- ::cgotoxy(x, y);
+ ::cgotoxy(x, y, get_cursor_region());
}
int line_reader::read_line(bool clear_previous)
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 51fe4aeb0b..2ee2f87119 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -323,6 +323,11 @@ void cgotoxy(int x, int y, GotoRegion region)
tiles.cgotoxy(x, y, region);
}
+GotoRegion get_cursor_region()
+{
+ return (tiles.get_cursor_region());
+}
+
void clear_message_window()
{
tiles.clear_message_window();
diff --git a/crawl-ref/source/libgui.h b/crawl-ref/source/libgui.h
index 535a7cef5e..db0146fa59 100644
--- a/crawl-ref/source/libgui.h
+++ b/crawl-ref/source/libgui.h
@@ -59,6 +59,7 @@ int getch_ck();
int clrscr();
void message_out(int *which_line, int colour, const char *s, int firstcol = 0);
void cgotoxy(int x, int y, GotoRegion region = GOTO_CRT);
+GotoRegion get_cursor_region();
void clear_message_window();
void delay(int ms);
void update_screen();
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index b2a0fdfe1e..6823a4c932 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -683,8 +683,12 @@ void usleep(unsigned long time)
#endif
#ifndef USE_TILE
+static GotoRegion _current_region = GOTO_CRT;
+
void cgotoxy(int x, int y, GotoRegion region)
{
+ _current_region = region;
+
ASSERT(x >= 1);
ASSERT(y >= 1);
switch (region)
@@ -710,6 +714,11 @@ void cgotoxy(int x, int y, GotoRegion region)
break;
}
}
+
+GotoRegion get_cursor_region()
+{
+ return (_current_region);
+}
#endif
///////////////////////////////////////////////////////////////////////
// Pattern matching
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index 51bd4520b0..a5eb544cc7 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -164,6 +164,7 @@ void usleep( unsigned long time );
#ifndef USE_TILE
void cgotoxy(int x, int y, GotoRegion region = GOTO_CRT);
+GotoRegion get_cursor_region();
#endif
template <typename T>
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index 62ac431970..75ac0b8d3a 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -1275,6 +1275,19 @@ void TilesFramework::cgotoxy(int x, int y, GotoRegion region)
TextRegion::cgotoxy(x, y);
}
+GotoRegion TilesFramework::get_cursor_region() const
+{
+ if (TextRegion::text_mode == m_region_crt)
+ return (GOTO_CRT);
+ if (TextRegion::text_mode == m_region_msg)
+ return (GOTO_MSG);
+ if (TextRegion::text_mode == m_region_stat)
+ return (GOTO_STAT);
+
+ ASSERT(!"Bogus region");
+ return (GOTO_CRT);
+}
+
// #define DEBUG_TILES_REDRAW
void TilesFramework::redraw()
{
diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h
index d0faa256a9..993de5c302 100644
--- a/crawl-ref/source/tilesdl.h
+++ b/crawl-ref/source/tilesdl.h
@@ -96,6 +96,7 @@ public:
void message_out(int *which_line, int colour, const char *s, int firstcol);
void cgotoxy(int x, int y, GotoRegion region = GOTO_CRT);
+ GotoRegion get_cursor_region() const;
int get_number_of_lines();
int get_number_of_cols();
void clear_message_window();