Compare commits
2 Commits
240ddc7e84
...
552f7d5774
Author | SHA1 | Date | |
---|---|---|---|
552f7d5774 | |||
05d505836c |
@ -689,6 +689,7 @@ fn pso_packet_data_enum<'a>(name: syn::Ident, repr_type: syn::Ident, variants: i
|
||||
.clone()
|
||||
.enumerate()
|
||||
.map(|(i, variant)| {
|
||||
let variant = &variant.ident;
|
||||
quote! {
|
||||
#i => #name::#variant,
|
||||
}
|
||||
@ -698,6 +699,7 @@ fn pso_packet_data_enum<'a>(name: syn::Ident, repr_type: syn::Ident, variants: i
|
||||
let variant_to_value = variants
|
||||
.enumerate()
|
||||
.map(|(i, variant)| {
|
||||
let variant = &variant.ident;
|
||||
quote! {
|
||||
#name::#variant => #repr_type::to_le_bytes(#i as #repr_type).to_vec(),
|
||||
}
|
||||
|
@ -5,8 +5,9 @@ use serde::{Serialize, Deserialize};
|
||||
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(PSOPacketData, Debug, Copy, Clone, Hash, PartialEq, Eq, strum::Display, strum::EnumString, Serialize, Deserialize)]
|
||||
#[derive(PSOPacketData, Default, Debug, Copy, Clone, Hash, PartialEq, Eq, strum::Display, strum::EnumString, Serialize, Deserialize)]
|
||||
pub enum CharacterClass {
|
||||
#[default]
|
||||
HUmar,
|
||||
HUnewearl,
|
||||
HUcast,
|
||||
@ -21,12 +22,6 @@ pub enum CharacterClass {
|
||||
FOnewearl,
|
||||
}
|
||||
|
||||
impl Default for CharacterClass {
|
||||
fn default() -> CharacterClass {
|
||||
CharacterClass::HUmar
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: TryFrom
|
||||
impl std::convert::From<u8> for CharacterClass {
|
||||
fn from(f: u8) -> CharacterClass {
|
||||
@ -96,8 +91,9 @@ impl CharacterClass {
|
||||
|
||||
|
||||
#[repr(u8)]
|
||||
#[derive(PSOPacketData, Debug, Copy, Clone, Hash, PartialEq, Eq, strum::Display, strum::EnumString, Serialize, Deserialize)]
|
||||
#[derive(PSOPacketData, Default, Debug, Copy, Clone, Hash, PartialEq, Eq, strum::Display, strum::EnumString, Serialize, Deserialize)]
|
||||
pub enum SectionID {
|
||||
#[default]
|
||||
Viridia,
|
||||
Greenill,
|
||||
Skyly,
|
||||
@ -110,12 +106,6 @@ pub enum SectionID {
|
||||
Whitill,
|
||||
}
|
||||
|
||||
impl Default for SectionID {
|
||||
fn default() -> SectionID {
|
||||
SectionID::Viridia
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: TryFrom
|
||||
impl From<u8> for SectionID {
|
||||
fn from(id: u8) -> SectionID {
|
||||
|
@ -489,7 +489,7 @@ impl ShipList {
|
||||
pub fn new(ships: Vec<ShipListEntry>) -> ShipList {
|
||||
ShipList {
|
||||
baseship: ShipListEntry {
|
||||
menu: ships.get(0).map(|s| s.menu).unwrap_or(0),
|
||||
menu: ships.first().map(|s| s.menu).unwrap_or(0),
|
||||
item: 0,
|
||||
flags: 0,
|
||||
name: utf8_to_utf16_array("Ship"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user