summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tileweb-text.cc
diff options
context:
space:
mode:
authorFlorian Diebold <flodiebold@gmail.com>2011-11-21 14:10:40 +0100
committerFlorian Diebold <flodiebold@gmail.com>2011-12-08 22:52:58 +0100
commit81ea3dd754de1b78497ee8da8c19e2a7a5a78232 (patch)
tree67aaa6ba3d570a8c5136f000742114b825b073fd /crawl-ref/source/tileweb-text.cc
parent15055ff1e639201928917d7f54f1d0a61ffad2a7 (diff)
downloadcrawl-ref-81ea3dd754de1b78497ee8da8c19e2a7a5a78232.tar.gz
crawl-ref-81ea3dd754de1b78497ee8da8c19e2a7a5a78232.zip
Allow other CRT dialogs to be displayed like a menu in Webtiles.
This mainly means at the moment that the menu is shown as a dialog floating above the normal layer, instead of switching to the separate CRT layer.
Diffstat (limited to 'crawl-ref/source/tileweb-text.cc')
-rw-r--r--crawl-ref/source/tileweb-text.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/crawl-ref/source/tileweb-text.cc b/crawl-ref/source/tileweb-text.cc
index 47afd71e21..7c04bebc9c 100644
--- a/crawl-ref/source/tileweb-text.cc
+++ b/crawl-ref/source/tileweb-text.cc
@@ -93,8 +93,7 @@ void WebTextArea::send(bool force)
if (!force && !m_dirty) return;
m_dirty = false;
- bool start = true;
- uint8_t last_col = 0;
+ int last_col = -1;
int space_count = 0;
bool dirty = false;
std::wstringstream html;
@@ -103,7 +102,7 @@ void WebTextArea::send(bool force)
for (int y = 0; y < my; ++y)
{
- start = true;
+ last_col = -1;
space_count = 0;
dirty = false;
html.str(L"");
@@ -130,13 +129,14 @@ void WebTextArea::send(bool force)
}
}
- if ((col != last_col) && !start)
- html << "</span>";
- if ((col != last_col) || start)
+ if (col != last_col && chr != ' ')
+ {
+ if (last_col != -1)
+ html << "</span>";
html << "<span class=\\\"fg" << (col & 0xf)
<< " bg" << ((col >> 4) & 0xf) << "\\\">";
- last_col = col;
- start = false;
+ last_col = col;
+ }
if (chr == ' ' && ((col >> 4) & 0xF) == 0)
space_count++;
@@ -166,12 +166,15 @@ void WebTextArea::send(bool force)
}
}
- if (dirty || force)
+ if (dirty || (force && !html.str().empty()))
{
if (!sending)
{
- tiles.write_message("{msg:'txt',id:'%s',lines:{",
+ tiles.write_message("{msg:'txt',id:'%s'",
m_client_side_name.c_str());
+ if (force)
+ tiles.write_message(",clear:1");
+ tiles.write_message(",lines:{");
sending = true;
}