XPlor/definitions/cod/menulist.xscript
njohnson 8430428a91 Fix XScript syntax errors in COD definitions
- Convert match() function calls to if-else chains (match keyword conflict)
- Remove unsupported bracket attributes [table=..., columns=...]
- Expand inline statement with bracket attributes to explicit if block

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:50:59 -05:00

43 lines
948 B
Plaintext

type menulist [display="Menu List"]
{
const PTR_INLINE = -1;
i32 name_ptr;
ui("name_ptr", "Name Ptr");
u32 menu_count;
ui("menu_count", "Menu Count");
i32 menus_ptr;
ui("menus_ptr", "Menus Ptr");
// Inline data
if (name_ptr == PTR_INLINE) {
name = cstring();
ui("name", "Name");
set_name(name);
}
// Menu definitions (complex - need two passes)
if (menus_ptr == PTR_INLINE && menu_count > 0) {
// First pass: parse all menu pointers
menu_ptrs = 0;
repeat(menu_count) {
_ptr = parse_here("menuptr");
menu_ptrs = push("menu_ptrs", _ptr);
}
// Second pass: parse menudefs for inline pointers
menus = 0;
repeat(menu_count) {
_ptr_obj = get(menu_ptrs, _i);
_ptr_val = get(_ptr_obj, "ptr");
if (_ptr_val == PTR_INLINE) {
_menu = parse_here("menudef");
menus = push("menus", _menu);
}
}
// Table: menus (columns: name)
}
}