22 lines
536 B
Rust

use libpso::packet::login::{ShipList, ShipListEntry};
use libpso::utf8_to_utf16_array;
use networking::interserver::Ship;
pub const SHIP_MENU_ID: u32 = 1;
pub fn ship_list(ships: &[Ship]) -> ShipList {
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)
}