diff --git a/include/courtroom.h b/include/courtroom.h index 46da7a3..92b5a03 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -349,7 +349,6 @@ private: QVector arup_locks; QVector ic_chatlog_history; - int ic_chatlog_current = -1; QQueue chatmessage_queue; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 51f9dbd..24d8c5f 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2139,7 +2139,6 @@ void Courtroom::display_log_chatmessage(QString f_message, int f_char_id, QStrin break; } append_ic_text(shout_message, f_displayname, tr("shouts")); - ic_chatlog_current += 1; } // Obtain evidence ID we're trying to work with @@ -2150,16 +2149,14 @@ void Courtroom::display_log_chatmessage(QString f_message, int f_char_id, QStrin QString f_evi_name = local_evidence_list.at(f_evi_id - 1).name; // Append the message to the IC chatlogs in client append_ic_text(f_evi_name, f_displayname, tr("has presented evidence")); - ic_chatlog_current += 1; } } - + int current = ic_chatlog_history.size() - chatmessage_queue.size() - 1; // If the chat message isn't a blankpost, or the chatlog history is empty, or its last message isn't a blankpost - if (!f_message.isEmpty() || ic_chatlog_current == -1 || ic_chatlog_history[ic_chatlog_current].get_showname() != f_showname) { + if (!f_message.isEmpty() || current <= -1 || ic_chatlog_history[current].get_showname() != f_showname) { // Append the message to the IC chatlogs in client append_ic_text(f_message, f_displayname, "", f_color); - ic_chatlog_current += 1; } } @@ -3679,12 +3676,10 @@ void Courtroom::handle_song(QStringList *p_contents) if (f_song == "~stop.mp3") { log_ic_text(str_char, str_show, "", tr("has stopped the music")); append_ic_text("", str_show, tr("has stopped the music")); - ic_chatlog_current += 1; } else { log_ic_text(str_char, str_show, f_song, tr("has played a song")); append_ic_text(f_song_clear, str_show, tr("has played a song")); - ic_chatlog_current += 1; } music_player->play(f_song, channel, looping, effect_flags); if (f_song == "~stop.mp3") @@ -5246,14 +5241,12 @@ void Courtroom::on_showname_enable_clicked() void Courtroom::regenerate_ic_chatlog() { ui_ic_chatlog->clear(); - ic_chatlog_current = -1; foreach (chatlogpiece item, ic_chatlog_history) { append_ic_text(item.get_message(), ui_showname_enable->isChecked() ? item.get_showname() : item.get_name(), item.get_action(), item.get_chat_color(), item.get_datetime().toLocalTime()); - ic_chatlog_current += 1; } }