|
@ -438,7 +438,7 @@ impl<EG: EntityGateway> ShipServerState<EG> { |
|
|
Box::new(None.into_iter())
|
|
|
Box::new(None.into_iter())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
fn request_room_list(&mut self, id: ClientId, request_roomlist: &RoomListRequest) -> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> {
|
|
|
|
|
|
|
|
|
fn request_room_list(&mut self, id: ClientId) -> Box<dyn Iterator<Item = (ClientId, SendShipPacket)> + Send> {
|
|
|
let active_room_list = self.rooms.iter()
|
|
|
let active_room_list = self.rooms.iter()
|
|
|
.enumerate()
|
|
|
.enumerate()
|
|
|
.filter_map(|(i, r)| {
|
|
|
.filter_map(|(i, r)| {
|
|
@ -446,19 +446,22 @@ impl<EG: EntityGateway> ShipServerState<EG> { |
|
|
RoomList {
|
|
|
RoomList {
|
|
|
menu_id: ROOM_MENU_ID,
|
|
|
menu_id: ROOM_MENU_ID,
|
|
|
item_id: i as u32,
|
|
|
item_id: i as u32,
|
|
|
difficulty: room.difficulty,
|
|
|
|
|
|
players: room.players,
|
|
|
|
|
|
|
|
|
difficulty: room.get_difficulty_for_room_list(),
|
|
|
|
|
|
players: 0, // TODO
|
|
|
name: libpso::utf8_to_utf16_array!(room.name, 16),
|
|
|
name: libpso::utf8_to_utf16_array!(room.name, 16),
|
|
|
episode: room.episode,
|
|
|
|
|
|
flags: room.flags,
|
|
|
|
|
|
|
|
|
episode: room.get_episode_for_room_list(),
|
|
|
|
|
|
flags: room.get_flags_for_room_list(),
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
let baseroom: BaseRoom = BaseRoom {
|
|
|
|
|
|
|
|
|
let baseroom: RoomList = RoomList {
|
|
|
menu_id: ROOM_MENU_ID,
|
|
|
menu_id: ROOM_MENU_ID,
|
|
|
title_id: ROOM_MENU_ID,
|
|
|
|
|
|
zero: 0x0000,
|
|
|
|
|
|
menu_title: libpso::utf8_to_utf16_array!("Room list menu", 17),
|
|
|
|
|
|
|
|
|
item_id: ROOM_MENU_ID,
|
|
|
|
|
|
difficulty: 0x00,
|
|
|
|
|
|
players: 0x00,
|
|
|
|
|
|
name: libpso::utf8_to_utf16_array!("Room list menu", 16),
|
|
|
|
|
|
episode: 0,
|
|
|
|
|
|
flags: 0,
|
|
|
};
|
|
|
};
|
|
|
|
|
|
|
|
|
Box::new(vec![(id, SendShipPacket::RoomListResponse(RoomListResponse {
|
|
|
Box::new(vec![(id, SendShipPacket::RoomListResponse(RoomListResponse {
|
|
@ -530,8 +533,8 @@ impl<EG: EntityGateway> ServerState for ShipServerState<EG> { |
|
|
self.write_infoboard(id, pkt)
|
|
|
self.write_infoboard(id, pkt)
|
|
|
},
|
|
|
},
|
|
|
|
|
|
|
|
|
RecvShipPacket::RoomListRequest(pkt) => {
|
|
|
|
|
|
self.request_room_list(id, pkt)
|
|
|
|
|
|
|
|
|
RecvShipPacket::RoomListRequest(_req) => {
|
|
|
|
|
|
self.request_room_list(id)
|
|
|
},
|
|
|
},
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|