[meta] Map global TransformGroup to local TransformGroup indices;

This commit is contained in:
Benjamin Bouvier
2019-06-24 17:20:05 +02:00
parent 1e42aac41a
commit 4a6b88193e
4 changed files with 53 additions and 43 deletions

View File

@@ -148,6 +148,14 @@ impl SettingGroup {
}
panic!("Should have found bool setting by name.");
}
pub fn predicate_by_name(&self, name: &'static str) -> SettingPredicateNumber {
self.predicates
.iter()
.find(|pred| pred.name == name)
.unwrap_or_else(|| panic!("unknown predicate {}", name))
.number
}
}
/// This is the basic information needed to track the specific parts of a setting when building
@@ -209,10 +217,12 @@ struct ProtoPredicate {
node: PredicateNode,
}
pub type SettingPredicateNumber = u8;
pub struct Predicate {
pub name: &'static str,
node: PredicateNode,
pub number: u8,
pub number: SettingPredicateNumber,
}
impl Predicate {