aboutsummaryrefslogtreecommitdiff
path: root/stockton-types
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-types
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-types')
-rw-r--r--stockton-types/src/lib.rs2
-rw-r--r--stockton-types/src/world.rs19
2 files changed, 11 insertions, 10 deletions
diff --git a/stockton-types/src/lib.rs b/stockton-types/src/lib.rs
index 5a409d8..bf690f1 100644
--- a/stockton-types/src/lib.rs
+++ b/stockton-types/src/lib.rs
@@ -14,7 +14,7 @@
// with this program. If not, see <http://www.gnu.org/licenses/>.
//! Common types for all stockton crates.
-extern crate stockton_bsp;
+extern crate stockton_levels;
extern crate nalgebra_glm as na;
pub mod world;
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