- update: HotbarItem struct to remove unnecessary internal structures. We will never use the union members
- update: structs in types.rs to be public
This commit is contained in:
@@ -2,35 +2,22 @@ use std::time::{Duration};
|
|||||||
use bincode::{Encode, Decode};
|
use bincode::{Encode, Decode};
|
||||||
|
|
||||||
// `HotbarItem` structure converted to Rust.
|
// `HotbarItem` structure converted to Rust.
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Debug, Clone, Copy, Encode, Decode)]
|
||||||
struct HotbarItem {
|
pub(crate) struct HotbarItem {
|
||||||
data: HotbarItemData,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Definition for `data` union in `HotbarItem`.
|
|
||||||
#[derive(Clone, Copy)]
|
|
||||||
union HotbarItemData {
|
|
||||||
item: u16,
|
|
||||||
components: HotbarItemComponents,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
|
|
||||||
#[repr(C)]
|
|
||||||
struct HotbarItemComponents {
|
|
||||||
type_: u8,
|
type_: u8,
|
||||||
slot_id: u16,
|
slot_id: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `Skill` structure converted to Rust.
|
// `Skill` structure converted to Rust.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
|
||||||
struct Skill {
|
pub(crate) struct Skill {
|
||||||
id: u16,
|
id: u16,
|
||||||
level: u8,
|
level: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
// `StatusEffect` structure converted to Rust.
|
// `StatusEffect` structure converted to Rust.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
|
||||||
struct StatusEffect {
|
pub(crate) struct StatusEffect {
|
||||||
expired: Duration,
|
expired: Duration,
|
||||||
value: u16,
|
value: u16,
|
||||||
unknown: u16,
|
unknown: u16,
|
||||||
|
|||||||
Reference in New Issue
Block a user