21 lines
548 B
Rust
Raw Normal View History

2020-11-21 23:45:27 -07:00
use libpso::packet::login::{ShipList, ShipListEntry};
use libpso::utf8_to_utf16_array;
use crate::common::interserver::Ship;
use crate::login::character::SHIP_MENU_ID;
2021-06-18 11:53:23 -06:00
pub fn ship_list(ships: &[Ship]) -> ShipList {
2020-11-21 23:45:27 -07:00
let ships = ships.iter()
.enumerate()
.map(|(i, ship)| {
ShipListEntry {
menu: SHIP_MENU_ID,
item: i as u32,
flags: 0,
name: utf8_to_utf16_array!(ship.name, 0x11)
}
})
.collect();
ShipList::new(ships)
}