Skip to main content

lcf_enum

Macro lcf_enum 

Source
macro_rules! lcf_enum {
    (
        $(#[$meta:meta])*
        $vis:vis struct $name:ident {
            $(
                $(#[$vmeta:meta])*
                $vname:ident = $value:literal
            ),* $(,)?
        }
    ) => { ... };
}
Expand description

Define the named constants for an LCF enumeration.

LCF stores every enumeration as a plain compressed integer and RPG Maker writes values this schema does not know about, so this generates a transparent i32 newtype plus associated constants rather than a real enum. An unrecognised value is preserved exactly and written back unchanged - a real enum would have to either reject it or lose it, and both break round-tripping.

lcf_enum! {
    /// RPG::Actor::Condition
    pub struct ActorCondition {
        NORMAL = 0,
        POISON = 1,
    }
}