- 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:
2024-12-10 20:58:40 -05:00
parent d7922d9e01
commit 1220d7a031

View File

@@ -2,35 +2,22 @@ use std::time::{Duration};
use bincode::{Encode, Decode};
// `HotbarItem` structure converted to Rust.
#[derive(Clone, Copy)]
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 {
#[derive(Debug, Clone, Copy, Encode, Decode)]
pub(crate) struct HotbarItem {
type_: u8,
slot_id: u16,
}
// `Skill` structure converted to Rust.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
struct Skill {
pub(crate) struct Skill {
id: u16,
level: u8,
}
// `StatusEffect` structure converted to Rust.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)]
struct StatusEffect {
pub(crate) struct StatusEffect {
expired: Duration,
value: u16,
unknown: u16,