diff options
| author | troido <troido@protonmail.com> | 2020-03-05 18:42:43 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-03-05 18:42:43 +0100 |
| commit | 3332e38616db5a2d785fde69e8c82f20364d2b4e (patch) | |
| tree | 50c86da1a26ef2f7f09dd7617a75e234c027795d | |
| parent | 74e1707722325f9c97b42c56fb710744528b11f1 (diff) | |
print any failures in room loading to stdout
| -rw-r--r-- | src/world.rs | 8 | ||||
| -rw-r--r-- | todo.md | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/world.rs b/src/world.rs index 16ac4db..7b02d90 100644 --- a/src/world.rs +++ b/src/world.rs @@ -43,6 +43,14 @@ impl <'a, 'b>World<'a, 'b> { } fn get_room_mut(&mut self, id: &RoomId) -> Result<&mut Room<'a, 'b>> { + let result = self.get_room_mut_(id); + if let Err(err) = &result { + println!("Failed to load room {:?}: {:?}", id, err); + } + result + } + + fn get_room_mut_(&mut self, id: &RoomId) -> Result<&mut Room<'a, 'b>> { if !self.rooms.contains_key(id){ let template = self.template_loader.load_room(id.clone())?; let mut room: Room = Room::create(id.clone(), &self.encyclopedia, &template); @@ -1,13 +1,12 @@ # TODO +- save equipment +- save time - save variable arguments (health etc) - timer resource -- safely write files -- log failure in room loading - log world events to player - draw new entities -- equipment - room unloading - relative room locations - shortcuts for defining items |
