aboutsummaryrefslogtreecommitdiff
path: root/src/courtroom.cpp
diff options
context:
space:
mode:
authorCrystalwarrior <Varsash@Gmail.com>2022-07-30 03:45:42 +0300
committerGitHub <noreply@github.com>2022-07-29 19:45:42 -0500
commitf896475de414128fbc0f914224548e9dc5bd0cb3 (patch)
tree679a5582853aa6072341699ddac3f9634075d040 /src/courtroom.cpp
parente36d79f7499ca4484585fad7738df4764f3fd0aa (diff)
Stop iniswapping from modifying the char.ini file (#712)
* Stop iniswapping from modifying the char.ini (which can potentially remove comments such as credits, charmaker notes, etc.) * Fix iniswaps.ini and soundlist.ini not using vpath * Deprecate get_char_name, making "name=" part in the char.ini no longer a thing * Fix iniswap and emote dropdowns not getting properly updated when theme is reloaded * Prevent reload theme from resetting your emote to the first one * Fallback soundlist.ini Co-authored-by: stonedDiscord <Tukz@gmx.de> Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Diffstat (limited to 'src/courtroom.cpp')
-rw-r--r--src/courtroom.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index f14cc20e..ab1ea8a6 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1469,7 +1469,7 @@ void Courtroom::set_pos_dropdown(QStringList pos_dropdowns)
set_side(current_side);
}
-void Courtroom::update_character(int p_cid)
+void Courtroom::update_character(int p_cid, QString char_name, bool reset_emote)
{
bool newchar = m_cid != p_cid;
@@ -1483,7 +1483,10 @@ void Courtroom::update_character(int p_cid)
f_char = "";
}
else {
- f_char = ao_app->get_char_name(char_list.at(m_cid).name);
+ f_char = char_name;
+ if (char_name.isEmpty()) {
+ f_char = char_list.at(m_cid).name;
+ }
if (ao_app->is_discord_enabled())
ao_app->discord->state_character(f_char.toStdString());
@@ -1494,8 +1497,11 @@ void Courtroom::update_character(int p_cid)
set_text_color_dropdown();
- current_emote_page = 0;
- current_emote = 0;
+ // If our cid changed or we're being told to reset
+ if (newchar || reset_emote) {
+ current_emote_page = 0;
+ current_emote = 0;
+ }
if (m_cid == -1)
ui_emotes->hide();
@@ -4476,9 +4482,6 @@ void Courtroom::set_iniswap_dropdown()
ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")) +
ao_app->get_list_file(VPath("iniswaps.ini"));
- 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.prepend(char_list.at(m_cid).name);
iniswaps.removeDuplicates();
if (iniswaps.size() <= 0) {
@@ -4507,7 +4510,6 @@ void Courtroom::on_iniswap_dropdown_changed(int p_index)
{
ui_ic_chat_message->setFocus();
QString iniswap = ui_iniswap_dropdown->itemText(p_index);
- ao_app->set_char_ini(char_list.at(m_cid).name, iniswap, "name", "Options");
QStringList swaplist;
QStringList defswaplist = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini"));
@@ -4524,7 +4526,7 @@ void Courtroom::on_iniswap_dropdown_changed(int p_index)
ui_iniswap_dropdown->blockSignals(true);
ui_iniswap_dropdown->setCurrentIndex(p_index);
ui_iniswap_dropdown->blockSignals(false);
- update_character(m_cid);
+ update_character(m_cid, iniswap, true);
QString icon_path = ao_app->get_image_suffix(ao_app->get_character_path(
iniswap, "char_icon"));
ui_iniswap_dropdown->setItemIcon(p_index, QIcon(icon_path));
@@ -5407,7 +5409,7 @@ void Courtroom::on_reload_theme_clicked()
set_courtroom_size();
set_widgets();
- update_character(m_cid);
+ update_character(m_cid, ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()));
enter_courtroom();
gen_char_rgb_list(ao_app->get_chat(current_char));