diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2021-03-21 22:42:18 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-21 22:42:18 -0500 |
| commit | e9eba9b5ab1b022905d2f6dbe8e6ad2e2a516372 (patch) | |
| tree | 51d8e7e1ea8b79256e033ee3433c6d7a8565b6f6 | |
| parent | 94e55e70a21bd6fb0e2f25d6d5174fddf2c7cb08 (diff) | |
| parent | ba36356a8869c1d22802dc0e8c4706dc2ba0f54e (diff) | |
Merge pull request #503 from AttorneyOnline/fix/skip-queue
Fix chat queue being cleared with no way to see what the msgs were
| -rw-r--r-- | include/courtroom.h | 3 | ||||
| -rw-r--r-- | src/courtroom.cpp | 21 |
2 files changed, 21 insertions, 3 deletions
diff --git a/include/courtroom.h b/include/courtroom.h index 21191e58..9e0ae584 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -226,6 +226,9 @@ public: // Parse the chat message packet and unpack it into the m_chatmessage[ITEM] format void unpack_chatmessage(QStringList p_contents); + // Skip the current queue, adding all the queue messages to the logs if desynchronized logs are disabled + void skip_chatmessage_queue(); + enum LogMode { IO_ONLY, DISPLAY_ONLY, diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 754208ed..2d634879 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1247,7 +1247,7 @@ void Courtroom::set_background(QString p_background, bool display) // Clear the message queue text_queue_timer->stop(); - chatmessage_queue.clear(); + skip_chatmessage_queue(); text_state = 2; anim_state = 3; @@ -1961,8 +1961,10 @@ void Courtroom::chatmessage_enqueue(QStringList p_contents) int objection_mod = p_contents[OBJECTION_MOD].split("&")[0].toInt(); is_objection = objection_mod >= 1 && objection_mod <= 5; // If this is an objection, nuke the queue - if (is_objection) - chatmessage_queue.clear(); + if (is_objection) { + text_queue_timer->stop(); + skip_chatmessage_queue(); + } } // Record the log I/O, log files should be accurate. @@ -2008,6 +2010,19 @@ void Courtroom::chatmessage_dequeue() unpack_chatmessage(chatmessage_queue.dequeue()); } +void Courtroom::skip_chatmessage_queue() +{ + if (ao_app->is_desyncrhonized_logs_enabled()) { + chatmessage_queue.clear(); + return; + } + + while (!chatmessage_queue.isEmpty()) { + QStringList p_contents = chatmessage_queue.dequeue(); + log_chatmessage(p_contents[MESSAGE], p_contents[CHAR_ID].toInt(), p_contents[SHOWNAME], p_contents[TEXT_COLOR].toInt(), DISPLAY_ONLY); + } +} + void Courtroom::unpack_chatmessage(QStringList p_contents) { for (int n_string = 0; n_string < MS_MAXIMUM; ++n_string) { |
