diff options
author | Pekka Lampila <pekka.lampila@iki.fi> | 2013-04-28 02:46:20 +0300 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2013-05-21 02:59:57 -0400 |
commit | e9dec9982d0e095dfa387cf1ec0e1053f00d671b (patch) | |
tree | 13d06b470e23df42b1a2280e6d1ea579997c94ae /crawl-ref/source/message.cc | |
parent | b84bbcfdc572c76d3c7e9a398ac34f9950d5ba06 (diff) | |
download | crawl-ref-e9dec9982d0e095dfa387cf1ec0e1053f00d671b.tar.gz crawl-ref-e9dec9982d0e095dfa387cf1ec0e1053f00d671b.zip |
Fix WebTiles overflow more prompt losing one line
Hold of sending the line that caused a more prompt until that prompt is
cleared.
Diffstat (limited to 'crawl-ref/source/message.cc')
-rw-r--r-- | crawl-ref/source/message.cc | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index c359ae9b73..e9e6940f86 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -631,10 +631,18 @@ class message_store int unsent; // number of messages not yet sent to the webtiles client bool prev_unsent; int client_rollback; +#ifdef USE_TILE_WEB + bool send_ignore_one; +#endif public: message_store() : last_of_turn(false), temp(0), - unsent(0), prev_unsent(false), client_rollback(0) {} + unsent(0), prev_unsent(false), + client_rollback(0) +#ifdef USE_TILE_WEB + , send_ignore_one(false) +#endif + {} void add(const message_item& msg) { @@ -663,7 +671,15 @@ public: temp++; else reset_temp(); +#ifdef USE_TILE_WEB + // ignore this message until it's actually displayed in case we run out + // of space and have to display --more-- instead + send_ignore_one = true; +#endif msgwin.add_item(msg.with_repeats(), p, _temporary); +#ifdef USE_TILE_WEB + send_ignore_one = false; +#endif } void roll_back() @@ -726,7 +742,7 @@ public: void send(int old_msgs = 0) { unsent += old_msgs; - if (unsent == 0) return; + if (unsent == 0 || (send_ignore_one && unsent == 1)) return; if (client_rollback > 0) { @@ -736,7 +752,7 @@ public: if (old_msgs > 0) tiles.json_write_int("old_msgs", old_msgs); tiles.json_open_array("messages"); - for (int i = -unsent; i < 0; ++i) + for (int i = -unsent; i < (send_ignore_one ? -1 : 0); ++i) { message_item& msg = msgs[i]; tiles.json_open_object(); @@ -758,7 +774,7 @@ public: tiles.json_close_object(); } tiles.json_close_array(); - unsent = 0; + unsent = send_ignore_one ? 1 : 0; prev_unsent = false; } #endif |