From 86cc7950061f3efb346cc7510d71dfb681a26172 Mon Sep 17 00:00:00 2001 From: cents Date: Sat, 23 May 2020 09:23:42 -0700 Subject: [PATCH 1/4] Other image formats now support the present evidence --- src/aoevidencedisplay.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 9dd062b..64e4e24 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -34,11 +34,11 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, if (is_left_side) { icon_identifier = "left_evidence_icon"; - gif_name = "evidence_appear_left.gif"; + gif_name = "evidence_appear_left"; } else { icon_identifier = "right_evidence_icon"; - gif_name = "evidence_appear_right.gif"; + gif_name = "evidence_appear_right"; } pos_size_type icon_dimensions = @@ -49,9 +49,8 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, evidence_icon->setPixmap(f_pixmap.scaled( evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio)); - - QString f_default_gif_path = ao_app->get_default_theme_path(gif_name); - QString f_gif_path = ao_app->get_theme_path(gif_name); + QString f_default_gif_path = ao_app->get_image_suffix(ao_app->get_default_theme_path(gif_name)); + QString f_gif_path = ao_app->get_image_suffix(ao_app->get_theme_path(gif_name)); if (file_exists(f_gif_path)) final_gif_path = f_gif_path; From 53c72227c4ade7c3e28bf0051346d297f56e51be Mon Sep 17 00:00:00 2001 From: cents Date: Sat, 23 May 2020 09:54:33 -0700 Subject: [PATCH 2/4] Disable html injection --- src/courtroom.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 11c0bda..4d73507 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2293,12 +2293,10 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, bool delay_pop = false; while (trick_check_pos < p_text.size()) { f_character = p_text.at(trick_check_pos); - if (!skip_filter) { if (f_character == "<") f_character = "<"; else if (f_character == ">") f_character = ">"; - } // Escape character. if (f_character == "\\" && !ic_next_is_not_special) { ic_next_is_not_special = true; @@ -2511,10 +2509,9 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, * \param p_text The text to be appended * \param p_name The name of the character/entity who sent said text * \param is_songchange Whether we are appending a song entry - * \param force_filter If we are sending plain text and we want to force the - * \param filtering regardless of its status (e.g chat entry, song change etc) - * \param skip_filter If we are sending appending text such as html so we skip the - * \param filter chat_color The color of the message sent + * \param force_filter If we are sending plain text and we want to force the filtering regardless of its status (e.g chat entry, song change etc) + * \param skip_filter If we are sending appending text such as html so we skip the html filter + * \param chat_color The color of the message sent */ void Courtroom::append_ic_text(QString p_text, QString p_name, From c83fd9f7323464493b76af915e974c1dc2262686 Mon Sep 17 00:00:00 2001 From: cents Date: Sat, 23 May 2020 10:41:20 -0700 Subject: [PATCH 3/4] Added backwards compatibility for the music list --- src/packet_distribution.cpp | 42 +++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index a110ec4..36593d6 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -478,19 +478,39 @@ void AOApplication::server_packet_received(AOPacket *p_packet) bool musics_time = false; area_count = 0; - + bool legacy_system = false; + int element_ahead = 0; for (int n_element = 0; n_element < f_contents.size(); ++n_element) { - int element2check = n_element + 1; - if (element2check > f_contents.size()) { - element2check = n_element; // I know this is very lazy code but cba + element_ahead = n_element + 1; + if (!musics_time && f_contents.at(n_element).startsWith("==") && ( + f_contents.at(element_ahead).endsWith(".wav") || + f_contents.at(element_ahead).endsWith(".mp3") || + f_contents.at(element_ahead).endsWith(".mp4") || + f_contents.at(element_ahead).endsWith(".ogg") || + f_contents.at(element_ahead).endsWith(".opus"))) { + legacy_system = true; + } - if (!musics_time && (f_contents.at(n_element).startsWith("==") || - f_contents.at(element2check).endsWith(".wav") || - f_contents.at(element2check).endsWith(".mp3") || - f_contents.at(element2check).endsWith(".mp4") || - f_contents.at(element2check).endsWith(".ogg") || - f_contents.at(element2check).endsWith(".opus"))) { - musics_time = true; + if(!legacy_system) { + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(element_ahead).endsWith(".wav") || + f_contents.at(element_ahead).endsWith(".mp3") || + f_contents.at(element_ahead).endsWith(".mp4") || + f_contents.at(element_ahead).endsWith(".ogg") || + f_contents.at(element_ahead).endsWith(".opus"))) { + musics_time = true; + } + } + else{ + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(n_element).endsWith(".wav") || + f_contents.at(n_element).endsWith(".mp3") || + f_contents.at(n_element).endsWith(".mp4") || + f_contents.at(n_element).endsWith(".ogg") || + f_contents.at(n_element).endsWith(".opus"))) { + musics_time = true; + } + } // Not everything needs to have a thread. From 8ea01d4c3139e27e84091c0b24266d9fb50ddf38 Mon Sep 17 00:00:00 2001 From: cents Date: Sat, 23 May 2020 10:44:36 -0700 Subject: [PATCH 4/4] Clanged changes --- src/courtroom.cpp | 24 +++++++++-------- src/packet_distribution.cpp | 52 ++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 4d73507..f5361ef 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2170,8 +2170,7 @@ void Courtroom::handle_chatmessage_3() else first_message_sent = true; QString char_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; - ui_ic_chatlog->textCursor().insertHtml("" + char_name + - ": "); + ui_ic_chatlog->textCursor().insertHtml("" + char_name + ": "); } else { if (first_message_sent && log_goes_downwards) @@ -2293,10 +2292,10 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, bool delay_pop = false; while (trick_check_pos < p_text.size()) { f_character = p_text.at(trick_check_pos); - if (f_character == "<") - f_character = "<"; - else if (f_character == ">") - f_character = ">"; + if (f_character == "<") + f_character = "<"; + else if (f_character == ">") + f_character = ">"; // Escape character. if (f_character == "\\" && !ic_next_is_not_special) { ic_next_is_not_special = true; @@ -2509,9 +2508,10 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, * \param p_text The text to be appended * \param p_name The name of the character/entity who sent said text * \param is_songchange Whether we are appending a song entry - * \param force_filter If we are sending plain text and we want to force the filtering regardless of its status (e.g chat entry, song change etc) - * \param skip_filter If we are sending appending text such as html so we skip the html filter - * \param chat_color The color of the message sent + * \param force_filter If we are sending plain text and we want to force the + * filtering regardless of its status (e.g chat entry, song change etc) \param + * skip_filter If we are sending appending text such as html so we skip the html + * filter \param chat_color The color of the message sent */ void Courtroom::append_ic_text(QString p_text, QString p_name, @@ -2795,7 +2795,7 @@ void Courtroom::chat_tick() chat_tick_timer->stop(); int msg_delay = message_display_speed[current_display_speed]; if (slower_blips) - msg_delay = message_display_speed_slow[current_display_speed]; + msg_delay = message_display_speed_slow[current_display_speed]; // Stops blips from playing when we have a formatting option. bool formatting_char = false; @@ -2832,7 +2832,9 @@ void Courtroom::chat_tick() f_character = f_character.toHtmlEscaped(); if (punctuation_chars.contains(f_character)) { - msg_delay *= punctuation_modifier + 1; // Since we are handling a boolean, if its true its double (1 + 1) or false (1 + 0). + msg_delay *= + punctuation_modifier + 1; // Since we are handling a boolean, if its + // true its double (1 + 1) or false (1 + 0). // ui_vp_message->insertPlainText(f_character); } diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 36593d6..37231d8 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -482,35 +482,33 @@ void AOApplication::server_packet_received(AOPacket *p_packet) int element_ahead = 0; for (int n_element = 0; n_element < f_contents.size(); ++n_element) { element_ahead = n_element + 1; - if (!musics_time && f_contents.at(n_element).startsWith("==") && ( - f_contents.at(element_ahead).endsWith(".wav") || - f_contents.at(element_ahead).endsWith(".mp3") || - f_contents.at(element_ahead).endsWith(".mp4") || - f_contents.at(element_ahead).endsWith(".ogg") || - f_contents.at(element_ahead).endsWith(".opus"))) { - legacy_system = true; - + if (!musics_time && f_contents.at(n_element).startsWith("==") && + (f_contents.at(element_ahead).endsWith(".wav") || + f_contents.at(element_ahead).endsWith(".mp3") || + f_contents.at(element_ahead).endsWith(".mp4") || + f_contents.at(element_ahead).endsWith(".ogg") || + f_contents.at(element_ahead).endsWith(".opus"))) { + legacy_system = true; } - if(!legacy_system) { - if (!musics_time && (f_contents.at(n_element).startsWith("==") || - f_contents.at(element_ahead).endsWith(".wav") || - f_contents.at(element_ahead).endsWith(".mp3") || - f_contents.at(element_ahead).endsWith(".mp4") || - f_contents.at(element_ahead).endsWith(".ogg") || - f_contents.at(element_ahead).endsWith(".opus"))) { - musics_time = true; + if (!legacy_system) { + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(element_ahead).endsWith(".wav") || + f_contents.at(element_ahead).endsWith(".mp3") || + f_contents.at(element_ahead).endsWith(".mp4") || + f_contents.at(element_ahead).endsWith(".ogg") || + f_contents.at(element_ahead).endsWith(".opus"))) { + musics_time = true; + } } - } - else{ - if (!musics_time && (f_contents.at(n_element).startsWith("==") || - f_contents.at(n_element).endsWith(".wav") || - f_contents.at(n_element).endsWith(".mp3") || - f_contents.at(n_element).endsWith(".mp4") || - f_contents.at(n_element).endsWith(".ogg") || - f_contents.at(n_element).endsWith(".opus"))) { - musics_time = true; - } - + else { + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(n_element).endsWith(".wav") || + f_contents.at(n_element).endsWith(".mp3") || + f_contents.at(n_element).endsWith(".mp4") || + f_contents.at(n_element).endsWith(".ogg") || + f_contents.at(n_element).endsWith(".opus"))) { + musics_time = true; + } } // Not everything needs to have a thread.