If this error occurs, then the ENTIRE function is aborted in the middle of it trying to load flags.
No wonder the flags can get a bit messed up at times.
But while I managed to replicate this insanity EVERY time straight upon loading an old savegame by @Jason,
I haven't yet been able to replicate it on demand in other situations.
I found myself a bunch of pirate ships at sea, then made a Save at Sea and loaded that.
This time, everything behaved perfectly fine.
I now know what ISN'T the problem (it has nothing to do with array sizes), but the actual issue remains elusive.
What I did do is to slightly modify the GetPirateFlag function to ensure EVERY character gets the required attributes set.
Not sure if that will help, but it can't hurt.
No wonder the flags can get a bit messed up at times.
But while I managed to replicate this insanity EVERY time straight upon loading an old savegame by @Jason,
I haven't yet been able to replicate it on demand in other situations.
I found myself a bunch of pirate ships at sea, then made a Save at Sea and loaded that.
This time, everything behaved perfectly fine.
I now know what ISN'T the problem (it has nothing to do with array sizes), but the actual issue remains elusive.
What I did do is to slightly modify the GetPirateFlag function to ensure EVERY character gets the required attributes set.
Not sure if that will help, but it can't hurt.
