|
@ -162,11 +162,11 @@ where |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
pub fn update_player_position(id: ClientId,
|
|
|
pub fn update_player_position(id: ClientId,
|
|
|
clients: &mut Clients,
|
|
|
|
|
|
client_location: &ClientLocation,
|
|
|
|
|
|
rooms: &Rooms,
|
|
|
|
|
|
message: &GameMessage,)
|
|
|
|
|
|
-> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, ShipError> {
|
|
|
|
|
|
|
|
|
message: &GameMessage,
|
|
|
|
|
|
clients: &mut Clients,
|
|
|
|
|
|
client_location: &ClientLocation,
|
|
|
|
|
|
rooms: &Rooms)
|
|
|
|
|
|
-> Result<Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send>, ShipError> {
|
|
|
let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
if let Ok(room_id) = client_location.get_room(id).map_err(|err| -> ClientLocationError { err.into() }) {
|
|
|
if let Ok(room_id) = client_location.get_room(id).map_err(|err| -> ClientLocationError { err.into() }) {
|
|
|
let room = rooms.get(room_id.0)
|
|
|
let room = rooms.get(room_id.0)
|
|
|