commonlibsse_ng\re\t/
TESGlobal.rs1use core::ffi::{CStr, c_float};
8
9use crate::re::BSString::{BSString, BSStringError};
10use crate::re::FormTypes::FormType;
11use crate::re::TESForm::{TESForm, TESFormVtbl};
12use crate::re::offsets_rtti::RTTI_TESGlobal;
13use crate::re::offsets_vtable::VTABLE_TESGlobal;
14use crate::rel::id::VariantID;
15
16#[repr(C)]
18#[derive(Debug)]
19pub struct TESGlobal {
20 pub __base: TESForm,
22
23 pub form_editor_id: BSString,
26
27 pub type_: Type_CEnum,
30
31 pub pad31: u8,
34
35 pub pad32: u16,
38
39 pub value: c_float,
42}
43
44const _: () = {
45 assert!(core::mem::offset_of!(TESGlobal, __base) == 0x0);
46 assert!(core::mem::offset_of!(TESGlobal, form_editor_id) == 0x20);
47 assert!(core::mem::offset_of!(TESGlobal, type_) == 0x30);
48 assert!(core::mem::offset_of!(TESGlobal, pad31) == 0x31);
49 assert!(core::mem::offset_of!(TESGlobal, pad32) == 0x32);
50 assert!(core::mem::offset_of!(TESGlobal, value) == 0x34);
51 assert!(core::mem::size_of::<TESGlobal>() == 0x38);
52};
53
54#[commonlibsse_ng_derive_internal::ffi_enum]
56#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
57#[repr(u8)]
58pub enum Type {
59 Float = b'f',
61 Long = b'l',
63 Short = b's',
65}
66
67impl TESGlobal {
68 pub const RTTI: VariantID = RTTI_TESGlobal;
70
71 pub const VTABLE: [VariantID; 1] = VTABLE_TESGlobal;
73
74 pub const FORM_TYPE: FormType = FormType::Global;
75
76 #[inline]
78 pub const fn get_form_editor_id(&self) -> &CStr {
79 self.form_editor_id.as_c_str()
80 }
81
82 #[inline]
88 pub fn set_form_editor_id(&mut self, id: &CStr) -> Result<(), BSStringError> {
89 self.form_editor_id = BSString::from_c_str(id)?;
90 Ok(())
91 }
92}
93
94#[repr(C)]
96pub struct TESGlobalVtbl {
97 __base: TESFormVtbl,
98}