From 9ab689527b3ede7750579b1a926cf0cf88813463 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Wed, 3 Feb 2021 16:26:59 +0100 Subject: Add capability to draw rooms --- src/world/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/world/mod.rs') 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() + } +} -- cgit v1.2.3-70-g09d2