Browse Source

cleanup done_bursting

pbs
jake 5 years ago
parent
commit
2580004e07
  1. 31
      src/ship/packet/handler/room.rs
  2. 3
      src/ship/ship.rs

31
src/ship/packet/handler/room.rs

@ -108,43 +108,22 @@ pub fn done_bursting(id: ClientId,
-> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> { -> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> {
let area = client_location.get_area(id).unwrap(); let area = client_location.get_area(id).unwrap();
if let RoomLobby::Room(room_id) = area { if let RoomLobby::Room(room_id) = area {
let room = rooms.get_mut(room_id.0).unwrap().as_mut().unwrap();
rooms.get_mut(room_id.0).unwrap().as_mut().map(|room| {
room.bursting = false; room.bursting = false;
});
} }
Box::new(client_location.get_client_neighbors(id).unwrap().into_iter()
let area_client = client_location.get_local_client(id).unwrap(); // TODO: unwrap
Box::new(client_location.get_client_neighbors(id).unwrap().into_iter() // TODO: unwrap
.map(move |client| { .map(move |client| {
vec![ vec![
//(client.client, SendShipPacket::BurstDone72(BurstDone72::new())),
(client.client, SendShipPacket::Message(Message::new(GameMessage::BurstDone(BurstDone { (client.client, SendShipPacket::Message(Message::new(GameMessage::BurstDone(BurstDone {
client: 0,
client: area_client.local_client.id(),
target: 0 target: 0
})))), })))),
] ]
}).flatten()) }).flatten())
} }
pub fn done_bursting2(id: ClientId,
client_location: &ClientLocation,
rooms: &mut Rooms)
-> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> {
let area = client_location.get_area(id).unwrap();
if let RoomLobby::Room(room_id) = area {
let room = rooms.get_mut(room_id.0).unwrap().as_mut().unwrap();
room.bursting = false;
}
Box::new(client_location.get_client_neighbors(id).unwrap().into_iter()
.map(move |client| {
vec![
(client.client, SendShipPacket::BurstDone72(BurstDone72::new())),
/*(client.client, SendShipPacket::Message(Message::new(GameMessage::BurstDone(BurstDone {
client: 1,
target: 0
})))),*/
]
}).flatten())
}
pub fn request_room_list(id: ClientId, pub fn request_room_list(id: ClientId,
client_location: &ClientLocation, client_location: &ClientLocation,
rooms: &Rooms) rooms: &Rooms)

3
src/ship/ship.rs

@ -412,8 +412,7 @@ impl<EG: EntityGateway> ServerState for ShipServerState<EG> {
handler::room::done_bursting(id, &self.client_location, &mut self.rooms) handler::room::done_bursting(id, &self.client_location, &mut self.rooms)
}, },
RecvShipPacket::DoneBursting2(_) => { RecvShipPacket::DoneBursting2(_) => {
Box::new(None.into_iter())
//handler::room::done_bursting2(id, &self.client_location, &mut self.rooms)
handler::room::done_bursting(id, &self.client_location, &mut self.rooms)
}, },
RecvShipPacket::LobbySelect(pkt) => { RecvShipPacket::LobbySelect(pkt) => {
Box::new(handler::lobby::change_lobby(id, pkt.lobby, &mut self.client_location, &self.clients, &mut self.item_manager, &self.level_table, &mut self.rooms, &mut self.entity_gateway)?.into_iter()) Box::new(handler::lobby::change_lobby(id, pkt.lobby, &mut self.client_location, &self.clients, &mut self.item_manager, &self.level_table, &mut self.rooms, &mut self.entity_gateway)?.into_iter())

Loading…
Cancel
Save