use ShipList::new

This commit is contained in:
jake 2019-11-04 22:07:04 -08:00
parent f718bc1d5b
commit ea1f59899d

View File

@ -212,16 +212,15 @@ impl<EG: EntityGateway> CharacterServerState<EG> {
fn send_ship_list(&mut self, _id: ClientId, _pkt: &Login) -> Result<Vec<SendCharacterPacket>, CharacterError> { fn send_ship_list(&mut self, _id: ClientId, _pkt: &Login) -> Result<Vec<SendCharacterPacket>, CharacterError> {
Ok(vec![SendCharacterPacket::Timestamp(Timestamp::new(chrono::Utc::now())), Ok(vec![SendCharacterPacket::Timestamp(Timestamp::new(chrono::Utc::now())),
SendCharacterPacket::ShipList(ShipList { SendCharacterPacket::ShipList(ShipList::new(self.ships.iter().enumerate().map(|(i, s)| {
ships: self.ships.iter().enumerate().map(|(i, s)| { ShipListEntry {
ShipListEntry { menu: SHIP_MENU_ID,
menu: SHIP_MENU_ID, item: i as u32,
item: i as u32, flags: 0,
flags: 0, name: utf8_to_utf16_array!(s.name, 0x11)
name: utf8_to_utf16_array!(s.name, 0x11)
} }
}).collect() }).collect()))
})]) ])
} }
fn get_settings(&mut self, id: ClientId) -> Result<Vec<SendCharacterPacket>, CharacterError> { fn get_settings(&mut self, id: ClientId) -> Result<Vec<SendCharacterPacket>, CharacterError> {