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
This commit is contained in:
parent
704c279f48
commit
967e6a00ff
@ -1526,15 +1526,15 @@ void Courtroom::update_character(int p_cid)
|
|||||||
for (const QString &filename : custom_obj) {
|
for (const QString &filename : custom_obj) {
|
||||||
CustomObjection custom_objection;
|
CustomObjection custom_objection;
|
||||||
custom_objection.filename = filename;
|
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;
|
QAction *action;
|
||||||
if (custom_name != "") {
|
if (custom_name != "") {
|
||||||
custom_objection.name = custom_name;
|
custom_objection.name = custom_name;
|
||||||
action = custom_obj_menu->addAction(custom_name);
|
action = custom_obj_menu->addAction(custom_name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
custom_objection.name = filename.split(".")[0];
|
custom_objection.name = filename.left(filename.lastIndexOf("."));
|
||||||
action = custom_obj_menu->addAction(filename.split(".")[0]);
|
action = custom_obj_menu->addAction(custom_objection.name);
|
||||||
}
|
}
|
||||||
if (custom_obj_menu->defaultAction() == nullptr) {
|
if (custom_obj_menu->defaultAction() == nullptr) {
|
||||||
custom_obj_menu->setDefaultAction(action);
|
custom_obj_menu->setDefaultAction(action);
|
||||||
@ -2374,9 +2374,8 @@ bool Courtroom::handle_objection()
|
|||||||
// case 4 is AO2 only
|
// case 4 is AO2 only
|
||||||
case 4:
|
case 4:
|
||||||
if (custom_objection != "") {
|
if (custom_objection != "") {
|
||||||
filename = "custom_objections/" + custom_objection;
|
filename = "custom_objections/" + custom_objection.left(custom_objection.lastIndexOf("."));
|
||||||
objection_player->play(
|
objection_player->play(filename,
|
||||||
"custom_objections/" + custom_objection.split('.')[0],
|
|
||||||
m_chatmessage[CHAR_NAME],
|
m_chatmessage[CHAR_NAME],
|
||||||
ao_app->get_chat(m_chatmessage[CHAR_NAME]));
|
ao_app->get_chat(m_chatmessage[CHAR_NAME]));
|
||||||
}
|
}
|
||||||
@ -5332,8 +5331,6 @@ void Courtroom::on_reload_theme_clicked()
|
|||||||
enter_courtroom();
|
enter_courtroom();
|
||||||
gen_char_rgb_list(ao_app->get_chat(current_char));
|
gen_char_rgb_list(ao_app->get_chat(current_char));
|
||||||
|
|
||||||
objection_custom = "";
|
|
||||||
|
|
||||||
// to update status on the background
|
// to update status on the background
|
||||||
set_background(current_background, true);
|
set_background(current_background, true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user