Skip to content

Commit

Permalink
presenting same evidnce wont clear it
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystalwarrior committed Nov 27, 2024
1 parent f9bfa85 commit c602e60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/aoevidencedisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class AOEvidenceDisplay : public QLabel {
void reset();
void combo_resize(int w, int h);

int last_evidence_index = -1;
signals:
void show_evidence_details(int index);

Expand All @@ -27,7 +28,6 @@ class AOEvidenceDisplay : public QLabel {
InterfaceLayer *evidence_movie;
QPushButton *evidence_icon;
AOSfxPlayer *sfx_player;
int last_evidence_index = -1;

private slots:
void show_done();
Expand Down
1 change: 1 addition & 0 deletions src/aoevidencedisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void AOEvidenceDisplay::reset()
evidence_movie->kill();
evidence_icon->hide();
this->clear();
last_evidence_index = -1;
}

void AOEvidenceDisplay::show_done() { evidence_icon->show(); }
Expand Down
9 changes: 7 additions & 2 deletions src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2654,7 +2654,9 @@ void Courtroom::unpack_chatmessage(QStringList p_contents)
evidence_presented = false;
ui_vp_objection->stop();
chat_tick_timer->stop();
ui_vp_evidence_display->reset();
if (ui_vp_evidence_display->last_evidence_index != m_chatmessage[EVIDENCE_ID].toInt())
ui_vp_evidence_display->reset();

// This chat msg is not objection so we're not waiting on the objection animation to finish to display the character.
if (!handle_objection())
handle_ic_message();
Expand Down Expand Up @@ -2748,7 +2750,7 @@ void Courtroom::log_chatmessage(QString f_message, int f_char_id, QString f_show
}

// If the evidence ID is in the valid range
if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) {
if (f_evi_id != ui_vp_evidence_display->last_evidence_index && f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) {
blankpost = false;
// Obtain the evidence name
QString f_evi_name = local_evidence_list.at(f_evi_id - 1).name;
Expand Down Expand Up @@ -3483,6 +3485,9 @@ void Courtroom::display_evidence_image()
{
QString side = m_chatmessage[SIDE];
int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt();
if (current_side == side && f_evi_id == ui_vp_evidence_display->last_evidence_index)
return;

if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) {
// shifted by 1 because 0 is no evidence per legacy standards
QString f_image = local_evidence_list.at(f_evi_id - 1).image;
Expand Down

0 comments on commit c602e60

Please sign in to comment.