• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Medium Priority 3D Sailing Mode: Flag-related Error Log

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. :shrug
 
I have an ATTEMPTED FIX for this! Extract attached to PROGRAM\SEA_AI .

Basically, just added a crazy amount of 'makeint' function calls here, "just in case":
Code:
    if (!IsEntity(&PirateFlag[makeint(ntexture)])) { // PB: Add 'makeint' everywhere to avoid error logs
       sid = "" + ntexture;
       CreateEntity(&PirateFlag[makeint(ntexture)], "PFg" + sid);
       LayerAddObject(sCurrentSeaExecute, &PirateFlag[makeint(ntexture)], iPriority);
       LayerAddObject(sCurrentSeaRealize, &PirateFlag[makeint(ntexture)], iPriority);
       LayerAddObject("sea_reflection",  &PirateFlag[makeint(ntexture)], 3);
       iPriority++;

       if (hasPennant) {
         CreateEntity(&PiratePennant[makeint(ntexture)], "PPn" + sid);
         LayerAddObject(sCurrentSeaExecute, &PiratePennant[makeint(ntexture)], iPriority);
         LayerAddObject(sCurrentSeaRealize, &PiratePennant[makeint(ntexture)], iPriority);
         LayerAddObject("sea_reflection",  &PiratePennant[makeint(ntexture)], 3);
         iPriority++;
       }
     }
Seems to have helped. I also tried a single call at the beginning with ntexture = makeint(ntexture), but that didn't work.

It could be that this is ONLY needed on the IsEntity line, but since I do not understand this one bit, I'd rather be safe than sorry, so I added it EVERYWHERE!

As far as I can tell, I have observed correlation between this file and the lack of those annoying error.log entries.
So I'll add that to the next modpack and we'll see what happens....
 

Attachments

  • AIShip.c
    220.7 KB · Views: 311
Last edited:
Back
Top