aboutsummaryrefslogtreecommitdiff
path: root/src/world/mod.rs
diff options
context:
space:
mode:
authorArne Dußin2021-02-03 10:51:08 +0100
committerArne Dußin2021-02-03 10:51:08 +0100
commitd4c1c7ecb5688ef64f45425d9ac8e7ddeb8e8602 (patch)
tree6788d2efc22373d735947ba46d3a3ea3b3b3733c /src/world/mod.rs
parentf92e9f6f07b1e3834c2ca58ce3510734819d08e4 (diff)
downloadgraf_karto-d4c1c7ecb5688ef64f45425d9ac8e7ddeb8e8602.tar.gz
graf_karto-d4c1c7ecb5688ef64f45425d9ac8e7ddeb8e8602.zip
Fix commands
Commands now operate on the local file system, but on the remote world
Diffstat (limited to 'src/world/mod.rs')
-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> {