diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:20 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:20 +0100 |
commit | 51168c753286eeee64410ab19dc9f78a4ea479e4 (patch) | |
tree | d384093c6fd11b36b189013b663f3500b18ec2a4 /stockton-types/src/world.rs | |
parent | d076d3a6fd484e298915cd85609ba9706abacc87 (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-types/src/world.rs')
-rw-r--r-- | stockton-types/src/world.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/stockton-types/src/world.rs b/stockton-types/src/world.rs index 2c677b7..8294523 100644 --- a/stockton-types/src/world.rs +++ b/stockton-types/src/world.rs @@ -15,18 +15,19 @@ //! The thing you play on and all the associated state. -use stockton_bsp::BSPFile; +use stockton_levels::prelude::*; /// A loaded world. -pub struct World { - pub map: BSPFile +pub struct World<T: MinBSPFeatures> { + pub map: T, } -impl World { - /// Create a new world from a BSPFile. - pub fn new(bsp: BSPFile) -> Option<World> { - Some(World { - map: bsp - }) +impl<T: MinBSPFeatures> World<T> { + /// Create a new world from a level. + /// The level can be any format, as long as it has the required features of a bsp. + pub fn new(map: T) -> World<T> { + World { + map + } } }
\ No newline at end of file |