From 3332e38616db5a2d785fde69e8c82f20364d2b4e Mon Sep 17 00:00:00 2001 From: troido Date: Thu, 5 Mar 2020 18:42:43 +0100 Subject: print any failures in room loading to stdout --- src/world.rs | 8 ++++++++ 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); diff --git a/todo.md b/todo.md index 05e2701..687da0d 100644 --- a/todo.md +++ b/todo.md @@ -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 -- cgit