mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Extract method for checking palette invariants
This commit is contained in:
parent
c834e2907d
commit
edb628d0b2
|
@ -228,19 +228,28 @@ mod test {
|
||||||
return false
|
return false
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i, palette) in palettes.into_iter().take(16).enumerate() {
|
check_palette_invariants(palettes.iter().take(16), optimisation_results, transparent_colour)
|
||||||
let optimised_palette = &optimisation_results.optimised_palettes[optimisation_results.assignments[i]];
|
}
|
||||||
if !palette.is_satisfied_by(optimised_palette) {
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if optimised_palette.colour_index(transparent_colour) != 0 {
|
fn check_palette_invariants<'a>(
|
||||||
return false;
|
palettes: impl Iterator<Item = &'a Palette16>,
|
||||||
}
|
optimisation_results: Palette16OptimisationResults,
|
||||||
|
transparent_colour: Colour,
|
||||||
|
) -> bool {
|
||||||
|
for (i, palette) in palettes.enumerate() {
|
||||||
|
let optimised_palette =
|
||||||
|
&optimisation_results.optimised_palettes[optimisation_results.assignments[i]];
|
||||||
|
if !palette.is_satisfied_by(optimised_palette) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
true
|
if optimised_palette.colour_index(transparent_colour) != 0 {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Arbitrary for Palette16 {
|
impl Arbitrary for Palette16 {
|
||||||
|
|
Loading…
Reference in a new issue