aboutsummaryrefslogtreecommitdiff
path: root/src/world/mod.rs
diff options
context:
space:
mode:
authorArne Dußin2021-02-03 16:26:59 +0100
committerArne Dußin2021-02-03 16:26:59 +0100
commit9ab689527b3ede7750579b1a926cf0cf88813463 (patch)
tree959894450512ebb10e86ed62058da1d7039614ef /src/world/mod.rs
parentd4c1c7ecb5688ef64f45425d9ac8e7ddeb8e8602 (diff)
downloadgraf_karto-9ab689527b3ede7750579b1a926cf0cf88813463.tar.gz
graf_karto-9ab689527b3ede7750579b1a926cf0cf88813463.zip
Add capability to draw rooms
Diffstat (limited to 'src/world/mod.rs')
-rw-r--r--src/world/mod.rs16
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()
+ }
+}