• 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!

Solved Fixing the Different Flags Mod

Screwface

Flibustier
Storm Modder
As i think it's better to proceed step by step to avoid having too many bugs, i have managed to "extract" the period flags mod of the DR and updating it for Build 14 9.5 patch 1.

For the moment, it seems to work for me so i puted it on my ftp folder for those who would like to test it. It is made for Build 14 9.5 patch 1 but with some little differences :

The ships_init.c file is the one of the DR (build 9.5 version) so the last ship(s) who were added by patch 1 are not included. The heavytrader1, 2, 3, 4 are not included too just because DR seems to remove them but it add 4 warGalleons instead

I noticed that in Battle_interface\Flags.c, in the SetFortFlag function, a section of code cause CTDs. I have outcommented it and the CTDs seems to have desappear :

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->void SetFortFlag(ref rModel)
{
    if (!CheckAttribute(rModel, "fortcmdridx")) return;
    int idx = sti(rModel.fortcmdridx);
    if (idx < 0) return;
    ref chr = GetCharacter(idx);
/*    // Screwface : this section of code seems cause CTDs
    SendMessage(&Flag, "li", MSG_FLAG_DEL_GROUP, &rModel);
    SendMessage(&MerchantFlag, "li", MSG_FLAG_DEL_GROUP, &rModel);
    SendMessage(&PirateFlag, "li", MSG_FLAG_DEL_GROUP, &rModel);
    SendMessage(&PersonalFlag, "li", MSG_FLAG_DEL_GROUP, &rModel);
    SendMessage(&FortFlag, "li", MSG_FLAG_DEL_GROUP, &rModel);
*/
    int iNation = sti(chr.nation);
    switch (iNation) {
        case PIRATE:
            SendMessage(&PirateFlag, "lil", MSG_FLAG_INIT, &rModel, iNation);
        break;
        case PERSONAL_NATION:
            SendMessage(&PersonalFlag, "lil", MSG_FLAG_INIT, &rModel, iNation);
        break;
        // default:
            SendMessage(&FortFlag, "lil", MSG_FLAG_INIT, &rModel, iNation);
    }
}<!--c2--></div><!--ec2-->
I also noticed that in Nation relation interface, the pirate flag was missing. I fixed it in the picture.ini
This is for testing so be sure to make backup of your files before. I hope i have forgotten nothing <img src="style_emoticons/<#EMO_DIR#>/334_flashing.gif" style="vertical-align:middle" emoid=":flashing:" border="0" alt="334_flashing.gif" />

Of course a new game is required !
 
Wow... that is INCREDIBLY interesting! <img src="style_emoticons/<#EMO_DIR#>/piratesing.gif" style="vertical-align:middle" emoid=":shock" border="0" alt="piratesing.gif" />
That seems to have been the main mod causing instability in the Development Resources from what I have been able to gather, so this is GREAT!
With those lines commented out, does the mod actually still do what it's supposed to?

<b>Edit:</b>
Oh... And WarGalleon = HeavyTrader, just renamed. <img src="style_emoticons/<#EMO_DIR#>/dunno.gif" style="vertical-align:middle" emoid=":shrug" border="0" alt="dunno.gif" />
 
<!--quoteo(post=331298:date=Jun 20 2009, 11:04 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 20 2009, 11:04 PM) <a href="index.php?act=findpost&pid=331298"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->With those lines commented out, does the mod actually still do what it's supposed to?<!--QuoteEnd--></div><!--QuoteEEnd-->
yes it does ! Forts have their correct flags too ! Douwesen fort has no flag but i noticed that's the same without the mod

<!--quoteo(post=331298:date=Jun 20 2009, 11:04 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 20 2009, 11:04 PM) <a href="index.php?act=findpost&pid=331298"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Oh... And WarGalleon = HeavyTrader, just renamed.<!--QuoteEnd--></div><!--QuoteEEnd-->
Ok so just the dutch lineship of patch 1 is missing ?
 
Hmm... why would Douwesen fort have no flag though? <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
I just checked in my game installation and indeed there's no flag. Did it ever have one?

<!--quoteo(post=331308:date=Jun 20 2009, 11:38 PM:name=Screwface)--><div class='quotetop'>QUOTE (Screwface @ Jun 20 2009, 11:38 PM) <a href="index.php?act=findpost&pid=331308"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Ok so just the dutch lineship of patch 1 is missing ?<!--QuoteEnd--></div><!--QuoteEEnd-->I think so, yes. And Thomas the Terror has the proper code for that. She's actually got pennant locators already.
There wasn't many ships added recently, I think.
 
<!--quoteo(post=331310:date=Jun 20 2009, 11:45 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 20 2009, 11:45 PM) <a href="index.php?act=findpost&pid=331310"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Hmm... why would Douwesen fort have no flag though? <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
I just checked in my game installation and indeed there's no flag. Did it ever have one?<!--QuoteEnd--></div><!--QuoteEEnd-->
Very good question but i can't remember if it had one in stock game <img src="style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" /> It seems that's the only file which had been modified by the builds in douwesen island directory is the locators file. There is no link between this file and the flag on the fort.
 
I'll have a check in the stock game if I remember. If it's not there either, we might want to consider adding it. <img src="style_emoticons/<#EMO_DIR#>/whippa.gif" style="vertical-align:middle" emoid=":whipa" border="0" alt="whippa.gif" />
 
<!--quoteo(post=331293:date=Jun 20 2009, 10:28 PM:name=Screwface)--><div class='quotetop'>QUOTE (Screwface @ Jun 20 2009, 10:28 PM) <a href="index.php?act=findpost&pid=331293"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->The ships_init.c file is the one of the DR (build 9.5 version) so the last ship(s) who were added by patch 1 are not included. The heavytrader1, 2, 3, 4 are not included too just because DR seems to remove them but it add 4 warGalleons instead<!--QuoteEnd--></div><!--QuoteEEnd-->Turns out there were some more ships missing. See attached file for the corrected Build 14 Alpha 9.5 Patch 1 version.
 
<!--quoteo(post=331293:date=Jun 20 2009, 10:28 PM:name=Screwface)--><div class='quotetop'>QUOTE (Screwface @ Jun 20 2009, 10:28 PM) <a href="index.php?act=findpost&pid=331293"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I noticed that in Battle_interface\Flags.c, in the SetFortFlag function, a section of code cause CTDs. I have outcommented it and the CTDs seems to have desappear :<!--QuoteEnd--></div><!--QuoteEEnd--><b>*Insert obscene language*</b>
Not all CTDs; the famous "Kralendijk port" CTD has remained! <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/boom.gif" style="vertical-align:middle" emoid=":boom" border="0" alt="boom.gif" />:
To test, go from 3D sailing mode to the port scene at Kralendijk. CTD just after the reload. I'm <i>sooo</i> hoping this one can be sorted too! <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
Other CTDs:
- Start Hornblower storyline, CTD upon exiting the navy academy
- Go to 3D sailing mode near Guadeloupe from worldmap (maybe not always?)
- Start Master and Commander storyline, go to 3D sailing mode, then back to port (apparently similar to Kralendijk CTD)

Also an additional weird effect: USA flag is Dutch flag?
 
<!--quoteo(post=331293:date=Jun 21 2009, 06:28 AM:name=Screwface)--><div class='quotetop'>QUOTE (Screwface @ Jun 21 2009, 06:28 AM) <a href="index.php?act=findpost&pid=331293"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->As i think it's better to proceed step by step to avoid having too many bugs, i have managed to "extract" the period flags mod of the DR and updating it for Build 14 9.5 patch 1.

For the moment, it seems to work for me so i puted it on my ftp folder for those who would like to test it. It is made for Build 14 9.5 patch 1 but with some little differences :<!--QuoteEnd--></div><!--QuoteEEnd-->
Yay! This mod was the main reason I downloaded DR (and to try and get my JS code to work so Thomas could play it <img src="style_emoticons/<#EMO_DIR#>/laugh.gif" style="vertical-align:middle" emoid="xD:" border="0" alt="laugh.gif" />)

So half the reason is now possible without DR but the other half I havn't had any luck with <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" />
 
<!--quoteo(post=331331:date=Jun 21 2009, 01:01 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 21 2009, 01:01 AM) <a href="index.php?act=findpost&pid=331331"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Not all CTDs; the famous "Kralendijk port" CTD has remained! <img src="style_emoticons/<#EMO_DIR#>/modding.gif" style="vertical-align:middle" emoid=":modding" border="0" alt="modding.gif" /> <img src="style_emoticons/<#EMO_DIR#>/boom.gif" style="vertical-align:middle" emoid=":boom" border="0" alt="boom.gif" />:
To test, go from 3D sailing mode to the port scene at Kralendijk. CTD just after the reload. I'm <i>sooo</i> hoping this one can be sorted too! <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> <img src="style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->
I have identified the source of this CTD (eleuthera too). That comes from the refreshflags() function call in Landinterface.c file. if you outcomment this call, the CTD disappear but ships in ports have no flags on their masts <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /> It is not a fix but now we know where the bug comes from.

<!--quoteo(post=331331:date=Jun 21 2009, 01:01 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 21 2009, 01:01 AM) <a href="index.php?act=findpost&pid=331331"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->- Start Hornblower storyline, CTD upon exiting the navy academy<!--QuoteEnd--></div><!--QuoteEEnd-->
Not encountered yet !

<!--quoteo(post=331331:date=Jun 21 2009, 01:01 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 21 2009, 01:01 AM) <a href="index.php?act=findpost&pid=331331"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->- Go to 3D sailing mode near Guadeloupe from worldmap (maybe not always?)<!--QuoteEnd--></div><!--QuoteEEnd-->
Not encountered yet !

<!--quoteo(post=331331:date=Jun 21 2009, 01:01 AM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 21 2009, 01:01 AM) <a href="index.php?act=findpost&pid=331331"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Also an additional weird effect: USA flag is Dutch flag?<!--QuoteEnd--></div><!--QuoteEEnd-->
Fixed ! Just re-download the Battle_interface\flags.c file in the FTP directory <img src="style_emoticons/<#EMO_DIR#>/me.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="me.gif" />
 
Good work Screwface! But those coastal ships cause the most trouble. Everytime you go to 3d sea view for the first time in a storyline, the game crashes a lot.
 
The positive:
- Start Assassin storyline, go to 3D sailing mode, then back to port, no crash
- Start Hornblower storyline, exit navy academy, no crash

The negative:
- No flags on ships in port
- Start Assassin storyline, go to 3D sailing mode, CTD (possibly random; didn't reproduce on second try)
- Start Hornblower storyline, exit navy academy, visit residence, back to port, save: immediate CTD after saving - could reproduce
- Load the resulting save: works. Open F2>Questbook interface, immediate crash afterwards anyway
 
In fact, it seems that the CTDs come from the SetShipFlag() function which is called by refreshFlags function...
I seems that when you go to port, all the coastal ships (6) are not loaded in the port model but the setshipflag try to put flags on all of them so perhaps the reason of the crash could be here <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" />

<!--quoteo(post=331456:date=Jun 21 2009, 12:59 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 21 2009, 12:59 PM) <a href="index.php?act=findpost&pid=331456"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->- Load the resulting save: works. Open F2>Questbook interface, immediate crash afterwards anyway<!--QuoteEnd--></div><!--QuoteEEnd-->
this one is logical because a refreshflag() is also called by the InterfaceDoExit() function !
 
<!--quoteo(post=331467:date=Jun 21 2009, 03:03 PM:name=Screwface)--><div class='quotetop'>QUOTE (Screwface @ Jun 21 2009, 03:03 PM) <a href="index.php?act=findpost&pid=331467"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->In fact, it seems that the CTDs come from the SetShipFlag() function which is called by refreshFlags function...
I seems that when you go to port, all the coastal ships (6) are not loaded in the port model but the setshipflag try to put flags on all of them so perhaps the reason of the crash could be here <img src="style_emoticons/<#EMO_DIR#>/unsure.gif" style="vertical-align:middle" emoid=":?" border="0" alt="unsure.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->That sounds very plausible. Note that in some ports, there isn't a CTD.
Are these ports where all coastal raiders ARE anchored? Could very well be...

<!--quoteo(post=331467:date=Jun 21 2009, 03:03 PM:name=Screwface)--><div class='quotetop'>QUOTE (Screwface @ Jun 21 2009, 03:03 PM) <a href="index.php?act=findpost&pid=331467"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->this one is logical because a refreshflag() is also called by the InterfaceDoExit() function !<!--QuoteEnd--></div><!--QuoteEEnd-->Ah! That DOES explain it! <img src="style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" />
 
I just found a way to avoid CTD in ports ! could you test it ?
Just re-download Battle_interface.c\flags.c and Locations\locations_loader.c files on the ftp.
And restore your refreshflags() line in landinterface.c of course <img src="style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" />

It seems fix the bugs in ports but there are still CTDs when going to 3d sailing <img src="style_emoticons/<#EMO_DIR#>/duel_pa.gif" style="vertical-align:middle" emoid=":ixi" border="0" alt="duel_pa.gif" />
 
I'll download it, but don't know when I'll find time to test. In any case, this does sound promising! <img src="style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" />

For the on-sea CTDs, do you know yet why they happen at all?
 
Not yet but probably the reason is in the same function ! i'm still searching <img src="style_emoticons/<#EMO_DIR#>/sailr.gif" style="vertical-align:middle" emoid=":sail" border="0" alt="sailr.gif" />
 
Thanks a lot for working on this, Screwface! Once this mod is made stable, the rest shouldn't give too much trouble.
I was planning on trying to add the various DR mods into the next patch part-by-part myself, but your support in this is most welcome.
Especially considering that I would never be able to sort these CTDs on my own. <img src="style_emoticons/<#EMO_DIR#>/no.gif" style="vertical-align:middle" emoid=":no" border="0" alt="no.gif" />
 
Back
Top