aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrystalwarrior <Varsash@Gmail.com>2022-05-23 21:46:24 +0300
committerGitHub <noreply@github.com>2022-05-23 20:46:24 +0200
commit967e6a00ff64986f01d5292020de1face362e5cc (patch)
tree7ee60787036bbcb6f18dd0f78f932d8c103f3118
parent704c279f481e01e4b4e6a774c72fe8cee72ccd0f (diff)
Fix custom objection folders not working (#726)
Fix reload theme screwing up the default custom objection folder if a custom.gif doesn't exist near char.ini
-rw-r--r--src/courtroom.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 11f543aa..21d1accc 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -1526,15 +1526,15 @@ void Courtroom::update_character(int p_cid)
for (const QString &filename : custom_obj) {
CustomObjection custom_objection;
custom_objection.filename = filename;
- QString custom_name = ao_app->read_char_ini(f_char, filename.split(".")[0] + "_name", "Shouts");
+ QString custom_name = ao_app->read_char_ini(f_char, filename.left(filename.lastIndexOf(".")) + "_name", "Shouts");
QAction *action;
if (custom_name != "") {
custom_objection.name = custom_name;
action = custom_obj_menu->addAction(custom_name);
}
else {
- custom_objection.name = filename.split(".")[0];
- action = custom_obj_menu->addAction(filename.split(".")[0]);
+ custom_objection.name = filename.left(filename.lastIndexOf("."));
+ action = custom_obj_menu->addAction(custom_objection.name);
}
if (custom_obj_menu->defaultAction() == nullptr) {
custom_obj_menu->setDefaultAction(action);
@@ -2374,9 +2374,8 @@ bool Courtroom::handle_objection()
// case 4 is AO2 only
case 4:
if (custom_objection != "") {
- filename = "custom_objections/" + custom_objection;
- objection_player->play(
- "custom_objections/" + custom_objection.split('.')[0],
+ filename = "custom_objections/" + custom_objection.left(custom_objection.lastIndexOf("."));
+ objection_player->play(filename,
m_chatmessage[CHAR_NAME],
ao_app->get_chat(m_chatmessage[CHAR_NAME]));
}
@@ -5332,8 +5331,6 @@ void Courtroom::on_reload_theme_clicked()
enter_courtroom();
gen_char_rgb_list(ao_app->get_chat(current_char));
- objection_custom = "";
-
// to update status on the background
set_background(current_background, true);
}