I see that you changed
default to
defaultVal. I'd also suggest using
ptr in all places where you use
array as an identifier. In future versions,
array may become a
token, for complex arrays; as will
struct. We have already fixed std.zh (
repo for std.zh, here), renaming all instances of
array and
string to
ptr, for this very reason.
(A real
array datatype will also then use proper C-style pointer tokens, so you'd have
&ptr or
*ptr.)
This does look as if it will fix the issue for now. I forced a size check in my patch to avoid issues where the value stored as
(enemy->Misc[__GHI_NPC_DATA]&0xFFFF) is non-zero, but is not
actually an array.
While this may be an edge case, it's theoretically possible. Validating the size ensures that the function moves to its else block and ensures that there is never access to an invalid pointer: The array size here is always 24, hence why I tested for equality in my patch.
All that aside, how would you feel about making a repo for ghost?
I've considered refactoring it for 2.55, to produce ideal ASM, for performance reasons; and future versions could migrate from ffcs to npcs. An open repo for it would allow community enhancement, while remaining under your supervision.