Skip to content

Commit

Permalink
Don't treat plugin as override if medium flag is set
Browse files Browse the repository at this point in the history
If both override and medium flags are set then the plugin is loaded into an FDxx slot.
  • Loading branch information
Ortham committed Jun 20, 2024
1 parent 4a5f104 commit 70122fd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 70122fd

Please sign in to comment.