diff options
| author | troido <troido@protonmail.com> | 2020-02-23 01:18:17 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-23 01:18:17 +0100 |
| commit | 7262cfc53b4af978d6db1b91e3143200f906587f (patch) | |
| tree | f6aa651a3040a1389a9c4e82796f1c04b3c5198c /src/world.rs | |
| parent | 522aad7889cd62e96af7c420789507ccbf5b7aaa (diff) | |
rooms have named locations to be used by portals
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 05e6887..dad3f13 100644 --- a/src/world.rs +++ b/src/world.rs @@ -7,12 +7,12 @@ use crate::{ room::Room, worldloader::WorldLoader, persistence::PersistentStorage, - playerstate::PlayerState, + playerstate::{PlayerState, RoomPos}, encyclopedia::Encyclopedia, controls::Control, util::Result, aerr, - worldmessages::WorldMessage + worldmessages::WorldMessage, }; pub struct World<'a, 'b> { @@ -81,9 +81,10 @@ impl <'a, 'b>World<'a, 'b> { Ok(self.get_room_mut(&roomid)?.control_player(player, control)) } - fn migrate_player(&mut self, player: &PlayerId, destination: RoomId) -> Result<()> { + fn migrate_player(&mut self, player: &PlayerId, destination: RoomId, roompos: RoomPos) -> Result<()> { let mut state = self.discorporate_player(player)?; state.room = Some(destination); + state.pos = roompos; self.add_loaded_player(state) } @@ -100,8 +101,8 @@ impl <'a, 'b>World<'a, 'b> { for room in self.rooms.values_mut() { migrants.append(&mut room.emigrate()); } - for (player, destination) in migrants { - self.migrate_player(&player, destination).unwrap(); + for (player, destination, roompos) in migrants { + self.migrate_player(&player, destination, roompos).unwrap(); } } |
