From 715c9106dbff4524f3fdf5d23f762e5e6518e0cb Mon Sep 17 00:00:00 2001 From: troido Date: Mon, 24 Feb 2020 12:38:23 +0100 Subject: healing works now too, the first time based system --- src/world.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/world.rs') diff --git a/src/world.rs b/src/world.rs index 9c22e0f..9f86cb8 100644 --- a/src/world.rs +++ b/src/world.rs @@ -21,7 +21,8 @@ pub struct World<'a, 'b> { default_room: RoomId, players: HashMap, rooms: HashMap>, - encyclopedia: Encyclopedia + encyclopedia: Encyclopedia, + timestamp: i64 } @@ -34,7 +35,8 @@ impl <'a, 'b>World<'a, 'b> { default_room, encyclopedia, players: HashMap::new(), - rooms: HashMap::new() + rooms: HashMap::new(), + timestamp: 0 } } @@ -92,8 +94,9 @@ impl <'a, 'b>World<'a, 'b> { pub fn update(&mut self) { self.migrate(); for room in self.rooms.values_mut() { - room.update(); + room.update(self.timestamp); } + self.timestamp += 1; } fn migrate(&mut self) { -- cgit