diff options
author | Florian Diebold <flodiebold@gmail.com> | 2011-04-11 23:25:36 +0200 |
---|---|---|
committer | Florian Diebold <flodiebold@gmail.com> | 2011-06-26 17:41:19 +0200 |
commit | 57e158722534a254723791aa997f497b94b4bfbb (patch) | |
tree | 766d0b9216c2bef4afdbeee6c73f989edda4927c /crawl-ref/source/tileweb-text.cc | |
parent | 2b52fd2ba2649976b66639800cc286a6c6705098 (diff) | |
download | crawl-ref-57e158722534a254723791aa997f497b94b4bfbb.tar.gz crawl-ref-57e158722534a254723791aa997f497b94b4bfbb.zip |
Only send texts if they were changed, and fix a bug with buggy redraws after teleports.
Diffstat (limited to 'crawl-ref/source/tileweb-text.cc')
-rw-r--r-- | crawl-ref/source/tileweb-text.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crawl-ref/source/tileweb-text.cc b/crawl-ref/source/tileweb-text.cc index cb3d684d4e..f269e2471a 100644 --- a/crawl-ref/source/tileweb-text.cc +++ b/crawl-ref/source/tileweb-text.cc @@ -8,7 +8,8 @@ WebTextArea::WebTextArea(std::string name) : my(0), m_cbuf(NULL), m_abuf(NULL), - m_client_side_name(name) + m_client_side_name(name), + m_dirty(true) { } @@ -48,6 +49,8 @@ void WebTextArea::clear() m_cbuf[i] = ' '; m_abuf[i] = 0; } + + m_dirty = true; } void WebTextArea::put_character(ucs_t chr, int fg, int bg, int x, int y) @@ -55,12 +58,18 @@ void WebTextArea::put_character(ucs_t chr, int fg, int bg, int x, int y) ASSERT((x < mx) && (y < my) && (x >= 0) && (y >= 0)); uint8_t col = (fg & 0xf) + (bg << 4); + if ((m_cbuf[x + y * mx] != chr) || (m_abuf[x + y * mx] != col)) + m_dirty = true; + m_cbuf[x + y * mx] = chr; m_abuf[x + y * mx] = col; } void WebTextArea::send() { + if (!m_dirty) return; + m_dirty = false; + fprintf(stdout, "$(\"#%s\").html(\"", m_client_side_name.c_str()); uint8_t last_col = 0; |