diff options
| author | Crystalwarrior <Varsash@Gmail.com> | 2022-05-21 17:07:07 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-21 16:07:07 +0200 |
| commit | 9214952aea767f3b1feebda7d497bbdd07cf8586 (patch) | |
| tree | 662c7421f48c45b7546c741040e07b79e462f599 | |
| parent | 1544d5d3a6fa4db819975d0cda6afc20ec0987a2 (diff) | |
Fix iniswap remove button removing character iniswaps (#710)
Fix the character being added twice to the iniswap if the iniswap list contains the og character name
| -rw-r--r-- | src/courtroom.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f6fe7995..51e260dd 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -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(); @@ -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() |
