Skip to content

Commit 50beb7d

Browse files
Fix incorrect judge-button display behaviour(#884)
Co-authored-by: stonedDiscord <Tukz@gmx.de>
1 parent 74b0251 commit 50beb7d

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

src/courtroom.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,17 +1420,13 @@ void Courtroom::set_background(QString p_background, bool display)
14201420

14211421
void Courtroom::set_side(QString p_side)
14221422
{
1423-
QString f_side;
1424-
if (p_side == ao_app->get_char_side(current_char))
1425-
p_side = "";
1426-
current_side = p_side;
1427-
if (current_side == "") {
1428-
f_side = ao_app->get_char_side(current_char);
1429-
ui_pos_remove->hide();
1423+
if (p_side.isEmpty() || p_side == ao_app->get_char_side(current_char)) {
1424+
ui_pos_remove->hide();
1425+
current_side = ao_app->get_char_side(current_char);
14301426
}
14311427
else {
1432-
f_side = current_side;
1433-
ui_pos_remove->show();
1428+
ui_pos_remove->show();
1429+
current_side = p_side;
14341430
}
14351431

14361432
set_judge_buttons();
@@ -1440,7 +1436,7 @@ void Courtroom::set_side(QString p_side)
14401436
ui_pos_dropdown->blockSignals(true);
14411437
for (int i = 0; i < ui_pos_dropdown->count(); ++i) {
14421438
QString pos = ui_pos_dropdown->itemText(i);
1443-
if (pos == f_side) {
1439+
if (pos == current_side) {
14441440

14451441
// Set the index on dropdown ui element to let you know what pos you're on
14461442
// right now
@@ -1453,7 +1449,7 @@ void Courtroom::set_side(QString p_side)
14531449
}
14541450
}
14551451
// We will only get there if we failed the last step
1456-
ui_pos_dropdown->setEditText(f_side);
1452+
ui_pos_dropdown->setEditText(current_side);
14571453
// Unblock the signals so the element can be used for setting pos again
14581454
ui_pos_dropdown->blockSignals(false);
14591455
}
@@ -1479,7 +1475,6 @@ void Courtroom::set_pos_dropdown(QStringList pos_dropdowns)
14791475

14801476
// Unblock the signals so the element can be used for setting pos again
14811477
ui_pos_dropdown->blockSignals(false);
1482-
set_side(current_side);
14831478
}
14841479

14851480
void Courtroom::update_character(int p_cid, QString char_name, bool reset_emote)
@@ -1506,6 +1501,7 @@ void Courtroom::update_character(int p_cid, QString char_name, bool reset_emote)
15061501
}
15071502

15081503
current_char = f_char;
1504+
current_side = ao_app->get_char_side(current_char);
15091505
set_side(current_side);
15101506

15111507
set_text_color_dropdown();

src/packet_distribution.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
388388

389389
if (f_contents.size() >= 2) {
390390
// We have a pos included in the background packet!
391-
w_courtroom->set_side(f_contents.at(1));
391+
if (!f_contents.at(1).isEmpty())
392+
//Not touching it when its empty.
393+
w_courtroom->set_side(f_contents.at(1));
392394
}
393395
w_courtroom->set_background(f_contents.at(0), f_contents.size() >= 2);
394396
}

0 commit comments

Comments
 (0)