for my $mod ($set->mods) {
$has_layer = 1 if $ltml_tc->check($mod);
my $tag = $mod->tag;
- my @candidates;
- if (defined $tag) {
- my $old = $mods{$tag};
- @candidates = $old ? map $_->[0], @$old : ();
- } else {
- @candidates = values %mods;
+ my $old = $mods{$tag} || [];
+ for (@$old) {
+ next MOD if $_->[0]->cover($mod);
}
- $_->cover($mod) and next MOD for @candidates;
push @{$mods{$tag}}, [ $mod, $last_mod++ ];
push @mods, $mod;
}