Skip to content

Commit

Permalink
Fix medium plugin handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortham committed Jun 18, 2024
1 parent 753d729 commit 36d4a44
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ impl Plugin {
}

pub fn is_medium_plugin(&self) -> bool {
self.is_medium_flag_set()
// Light plugins saved by the Creation Kit have both the light and
// medium flags set.
self.is_medium_flag_set() && !self.is_light_flag_set()
}

pub fn is_override_plugin(&self) -> bool {
Expand Down Expand Up @@ -1794,6 +1796,16 @@ mod tests {
assert!(plugin.is_medium_plugin());
}

#[test]
fn is_medium_plugin_should_be_false_for_a_plugin_with_the_medium_and_light_flags_set() {
let mut plugin = Plugin::new(
GameId::Starfield,
Path::new("testing-plugins/Starfield/Data/Blank.small.esm"),
);
assert!(plugin.parse_file(true).is_ok());
assert!(!plugin.is_medium_plugin());
}

#[test]
fn is_override_plugin_should_be_true_for_a_plugin_with_the_override_flag_set_and_at_least_one_master_and_no_light_flag(
) {
Expand Down

0 comments on commit 36d4a44

Please sign in to comment.