aboutsummaryrefslogtreecommitdiff
path: root/src/world
diff options
context:
space:
mode:
Diffstat (limited to 'src/world')
-rw-r--r--src/world/mod.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/world/mod.rs b/src/world/mod.rs
index 047ca5c..f163269 100644
--- a/src/world/mod.rs
+++ b/src/world/mod.rs
@@ -34,6 +34,23 @@ pub struct World {
}
impl World {
+ /// Create a world from the raw parts of the world. The components must fit,
+ /// meaning no id must exist twice and the used ids must correspond to the
+ /// actually used ids. Use with care.
+ pub fn from_raw_unchecked(
+ rooms: StableVec<Room>,
+ walls: StableVec<Wall>,
+ icons: StableVec<Icon>,
+ used_ids: StableVec<()>,
+ ) -> Self {
+ Self {
+ rooms,
+ walls,
+ icons,
+ used_ids,
+ }
+ }
+
/// Load the world data from a file. Fails if the file does not exist or
/// cannot be correctly parsed.
pub fn load_from_file<P: AsRef<Path>>(path: P) -> io::Result<Self> {