aboutsummaryrefslogtreecommitdiff
path: root/src/text_file_functions.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2022-01-08 12:51:49 -0600
committeroldmud0 <oldmud0@users.noreply.github.com>2022-01-08 12:51:49 -0600
commit3ec3d3a1217842ef72d8326b6803af70b3f3caa9 (patch)
tree7a23eeaa94c6a1edb4a0a80075e531f5c8d2b385 /src/text_file_functions.cpp
parentc07ff3589762329226710ff5aa6db01b7cb9b9cc (diff)
Fix wrong precedence order for effects
This was causing the realization.png UI button to be loaded instead of the effect.
Diffstat (limited to 'src/text_file_functions.cpp')
-rw-r--r--src/text_file_functions.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index 59b684f4..a0caf9b8 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -875,14 +875,15 @@ QString AOApplication::get_effect(QString effect, QString p_char,
if (p_folder == "")
p_folder = read_char_ini(p_char, "effects", "Options");
- QString p_path = get_image("effects/" + effect, current_theme, get_subtheme(), default_theme, "");
- QString p_misc_path = get_image(effect, current_theme, get_subtheme(), default_theme, p_folder);
+ QStringList paths {
+ get_image("effects/" + effect, current_theme, get_subtheme(), default_theme, ""),
+ get_image(effect, current_theme, get_subtheme(), default_theme, p_folder)
+ };
- if (!file_exists(p_misc_path) && !file_exists(p_path))
- return "";
- else if (file_exists(p_misc_path))
- return p_misc_path;
- return p_path;
+ for (const auto &p : paths)
+ if (file_exists(p))
+ return p;
+ return {};
}
QString AOApplication::get_effect_property(QString fx_name, QString p_char,