diff options
| author | troido <troido@protonmail.com> | 2020-02-28 16:41:11 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-28 16:41:11 +0100 |
| commit | c846e929a88837094d7a5383a306df1fec56c333 (patch) | |
| tree | 48ab058d58c090ff00199af6b3eef7d64c7c2c95 /src/world.rs | |
| parent | b80036ef629e0803f3a70059a8fa12d1a2ae3b2d (diff) | |
more specific types!
Diffstat (limited to 'src/world.rs')
| -rw-r--r-- | src/world.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/world.rs b/src/world.rs index aed60ff..4152889 100644 --- a/src/world.rs +++ b/src/world.rs @@ -13,6 +13,7 @@ use crate::{ Result, aerr, worldmessages::WorldMessage, + Timestamp }; pub struct World<'a, 'b> { @@ -22,7 +23,7 @@ pub struct World<'a, 'b> { players: HashMap<PlayerId, RoomId>, rooms: HashMap<RoomId, Room<'a, 'b>>, encyclopedia: Encyclopedia, - timestamp: i64 + time: Timestamp } @@ -36,7 +37,7 @@ impl <'a, 'b>World<'a, 'b> { encyclopedia, players: HashMap::new(), rooms: HashMap::new(), - timestamp: 0 + time: Timestamp(0) } } @@ -47,7 +48,7 @@ impl <'a, 'b>World<'a, 'b> { if let Ok(state) = self.persistence.load_room(id.clone()){ room.load_saved(&state); } - let last_time = self.timestamp - 1; + let last_time = self.time - 1; if room.get_time() < last_time { room.update(last_time); } @@ -103,9 +104,9 @@ impl <'a, 'b>World<'a, 'b> { pub fn update(&mut self) { self.migrate(); for room in self.rooms.values_mut() { - room.update(self.timestamp); + room.update(self.time); } - self.timestamp += 1; + self.time.0 += 1; } fn migrate(&mut self) { |
