Skip to content

Commit

Permalink
Fix iniswap remove button removing character iniswaps (#710)
Browse files Browse the repository at this point in the history
Fix the character being added twice to the iniswap if the iniswap list contains the og character name
  • Loading branch information
Crystalwarrior authored May 21, 2022
1 parent 1544d5d commit 9214952
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4410,8 +4410,8 @@ void Courtroom::set_iniswap_dropdown()
if (ao_app->get_char_name(char_list.at(m_cid).name) != char_list.at(m_cid).name)
iniswaps.append(ao_app->get_char_name(char_list.at(m_cid).name));

iniswaps.removeDuplicates();
iniswaps.prepend(char_list.at(m_cid).name);
iniswaps.removeDuplicates();
if (iniswaps.size() <= 0) {
ui_iniswap_dropdown->hide();
ui_iniswap_remove->hide();
Expand Down Expand Up @@ -4494,12 +4494,13 @@ void Courtroom::on_iniswap_remove_clicked()
// client will crash
return;
}
if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) !=
char_list.at(m_cid).name) {
QStringList defswaplist = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini"));
QString iniswap = ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex());
if (iniswap != char_list.at(m_cid).name && !defswaplist.contains(iniswap)) {
ui_iniswap_dropdown->removeItem(ui_iniswap_dropdown->currentIndex());
on_iniswap_dropdown_changed(0); // Reset back to original
update_character(m_cid);
}
on_iniswap_dropdown_changed(0); // Reset back to original
update_character(m_cid);
}

void Courtroom::set_sfx_dropdown()
Expand Down

0 comments on commit 9214952

Please sign in to comment.