aboutsummaryrefslogtreecommitdiff
path: root/stockton-levels/src/q3/planes.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:20 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:20 +0100
commit51168c753286eeee64410ab19dc9f78a4ea479e4 (patch)
treed384093c6fd11b36b189013b663f3500b18ec2a4 /stockton-levels/src/q3/planes.rs
parentd076d3a6fd484e298915cd85609ba9706abacc87 (diff)
refactor(all): use new traits-based levels everywhere else.
unfortunately this also starts using an unstable feature - generic_associated_types see rust-lang/rust#44265
Diffstat (limited to 'stockton-levels/src/q3/planes.rs')
-rw-r--r--stockton-levels/src/q3/planes.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/stockton-levels/src/q3/planes.rs b/stockton-levels/src/q3/planes.rs
index 970ddde..dd4f3aa 100644
--- a/stockton-levels/src/q3/planes.rs
+++ b/stockton-levels/src/q3/planes.rs
@@ -45,10 +45,14 @@ pub fn from_data(data: &[u8]) -> Result<Box<[Plane]>> {
Ok(planes.into_boxed_slice())
}
-impl<'a> HasPlanes<'a> for Q3BSPFile {
- type PlanesIter = std::slice::Iter<'a, Plane>;
+impl HasPlanes for Q3BSPFile {
+ type PlanesIter<'a> = std::slice::Iter<'a, Plane>;
- fn planes_iter(&'a self) -> Self::PlanesIter {
+ fn planes_iter<'a>(&'a self) -> Self::PlanesIter<'a> {
self.planes.iter()
}
+
+ fn get_plane<'a>(&'a self, idx: u32) -> &'a Plane {
+ &self.planes[idx as usize]
+ }
} \ No newline at end of file