diff options
Diffstat (limited to 'src/world/mod.rs')
| -rw-r--r-- | src/world/mod.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/world/mod.rs b/src/world/mod.rs index f163269..a72031d 100644 --- a/src/world/mod.rs +++ b/src/world/mod.rs @@ -34,6 +34,16 @@ pub struct World { } impl World { + /// Create a new, empty world. + pub fn new() -> Self { + Self { + rooms: StableVec::new(), + walls: StableVec::new(), + icons: StableVec::new(), + used_ids: StableVec::new(), + } + } + /// 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. @@ -128,3 +138,9 @@ impl World { &self.walls } } + +impl Default for World { + fn default() -> Self { + Self::new() + } +} |
