From 70122fddcedf151663ee67a862d17fcc91503244 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 20 Jun 2024 17:31:44 +0100 Subject: [PATCH] Don't treat plugin as override if medium flag is set If both override and medium flags are set then the plugin is loaded into an FDxx slot. --- src/plugin.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugin.rs b/src/plugin.rs index 324ec4b..c8611d0 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -232,9 +232,10 @@ impl Plugin { pub fn is_override_plugin(&self) -> bool { // The override flag is unset by the game if the plugin has no masters or - // if the plugin's light flag is set. + // if the plugin's light or medium flags are set. self.is_override_flag_set() && !self.is_light_flag_set() + && !self.is_medium_flag_set() && self.masters().map(|m| !m.is_empty()).unwrap_or(false) } @@ -1882,6 +1883,18 @@ mod tests { assert!(!plugin.is_override_plugin()); } + #[test] + fn is_override_plugin_should_be_false_for_a_plugin_with_the_override_and_medium_flags_set() + { + let mut plugin = Plugin::new( + GameId::Starfield, + Path::new("testing-plugins/Starfield/Data/Blank - Override.medium.esm"), + ); + plugin.parse_file(true).unwrap(); + + assert!(!plugin.is_override_plugin()); + } + #[test] fn valid_light_form_id_range_should_be_0_to_0xfff() { let mut plugin = Plugin::new(