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

max land crew calculation

Aconcagua

Sailor Apprentice
Storm Modder
Somehow, I don't like the values very much that were chosen for crews (especially annoys me this case:
6 > 80, 7 > 150 difference 70,
7 > 150, 8 > 200 difference 50
), cause I think, the difference should grow for each next land crew size.

1. I added a new function to eliminate the currently duplicate code (see below)
2. several propositions for new values

<ol type='1'><li> changes made:
<ul><li>in characters.c added the following function:

<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>int GetMaxLandCrew(int crewQuantity)
{
int maxcrew = 0;
if(crewQuantity > 0)
{
maxcrew = 1;
if(crewQuantity >= 5) {maxcrew=2;}
if(crewQuantity >= 15) {maxcrew=3;}
if(crewQuantity >= 30) {maxcrew=4;}
if(crewQuantity >= 50) {maxcrew=5;}
if(crewQuantity >= 80) {maxcrew=6;}
if(crewQuantity >= 150) {maxcrew=7;}
if(crewQuantity >= 200) {maxcrew=8;}
if(crewQuantity >= 300) {maxcrew=9;}
if(crewQuantity >= 500) {maxcrew=10;}
}
return maxcrew;
}</div>
(currently original values used)</li><li>in Random_sailors_sit_tavern_dialog.c, line 21:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>int maxcrew = GetMaxLandCrew(PChar.Ship.Crew.Quantity);</div></li><li>in random_sailors_group_dialog.c, line 18:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>int maxcrew = GetMaxLandCrew(PChar.Ship.Crew.Quantity);</div></li><li>in Crewmember_fight_dialog.c, line 163ff:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>maxcrew = GetMaxLandCrew(sti(PChar.Ship.Crew.Quantity));
if(maxcrew > 0)
{
// continue with original code from following line on:
link.l1 = DLG_TEXT[6];
link.l1.go = "one";
//[...]
}</div></li><li>in Crewmember_alc_dialog.c, line 44ff:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>maxcrew = GetMaxLandCrew(sti(PChar.Ship.Crew.Quantity));
if(maxcrew > 0)
{
// continue with original code from following line on:
link.l1 = DLG_TEXT[6];
link.l1.go = "one";
//[...]
}</div></li></ul>
(the first file is in the PROGRAM dir, the others all in PROGRAM/DIALOGS)
</li><li> new values propositions
<ul><li> just a little fine tuning for the original list:
maxcrew of 7 for 130 crew members
maxcrew of 10 for 550 crew members</li><li> +15 / + 15 (*)/ +20 (*) (to make it a little harder) difference for each next member (except first steps):
(*): always leave some guards on the ship...
1: 1 / 5 / 5
2: 5 / 10 / 10
3: 15 / 25 / 30
4: 40 / 55 / 70
5: 80 / 100 / 130
6: 135 / 160 / 210
7: 205 / 235 / 310
8: 290 / 325 / 430
9: 390 / 430 / 570
10: 505 / 550 / 730
(guards for the +15 variant: 1: 5, 2 : 10, 3: 25</li><li> based on sqaring (easier) / cubing (harder)
1: 1 / 1
2: 4 / 8
3: 9 / 27
4: 16 / 48
5: 25 / 125
6: 36 / 216
7: 49 / 343
8: 64 / 512
9: 81 / 729
10: 100 1000</li></ul>
I personally like the +15 and +20 variants best (i personally switched to 15 with guards variant) - eventually this could be made selectable in the advanced options...
(using an int array, setting the values into it on selection)</li></ol>

Finally a slightly optimized variant of the new function (less readable however...), using my favorised values (this is the implemtation I'm using now):
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>int GetMaxLandCrew(int crewQuantity)
{
if(crewQuantity >= 5)
{
if(crewQuantity >= 10)
{
if(crewQuantity >= 25)
{
if(crewQuantity >= 55)
{
if(crewQuantity >= 100)
{
if(crewQuantity >= 160)
{
if(crewQuantity >= 235)
{
if(crewQuantity >= 325)
{
if(crewQuantity >= 430)
{
if(crewQuantity >= 550)
{
return 10;
}
return 9;
}
return 8;
}
return 7;
}
return 6;
}
return 5;
}
return 4;
}
return 3;
}
return 2;
}
return 1;
}
return 0;
}
</div>
 
Sorry, have overseen one file:

PROGRAM/Loc_ai/LAi_init.c, line 86:
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
maxcrew = GetMaxLandCrew(mainChr.Ship.Crew.Quantity);
if(maxcrew > 0)
{
//orginal code from here on:
for(con = 1; con <= 10; con++)
{
//[...]
</div>
 
Thanks a lot; this looks interesting. <img src="style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
BTW: I'm moving this thread to the Build Alpha & Brainstorming forum, since it's got to do with futher modpack development. <img src="style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
 
<!--quoteo(post=328423:date=Jun 13 2009, 05:41 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Jun 13 2009, 05:41 PM) <a href="index.php?act=findpost&pid=328423"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Could you possibly upload your modified code files for this?<!--QuoteEnd--></div><!--QuoteEEnd-->

I started modifying the <a href='index.php?showtopic=13700'>officer system</a>, as some files could already be affected, I'll deliver this together with the OS.
 
Fine by me and thanks in advance. <img src="style_emoticons/<#EMO_DIR#>/doff.gif" style="vertical-align:middle" emoid=":doff" border="0" alt="doff.gif" />
 
Well, I had a serious problem in my officer system, so rolled back almost all changes since then, until working again (used winmerge for that) - with a side effect of getting all changes made for this part - all to be found in View attachment PROGRAM.zip.

Additionally, there is included:
<ul><li>the initItems.c file from '<a href='index.php?showtopic=13664'>Unsellable items</a>'</li><li>the corrected itemsBox.c (same topic)</li><li>itemsTrade.c: outcommented an obsolete code line with no effects </li><li>Reinit.c: additional comments for items (helped me to test my changes on initItems)</li><li>SEA_AI/BOAL_Deck.c: found a part where some, but not all officer types are checked - added a comment with a TODO</li></ul>

The bugfixes for the models, however, are not included...
 
Thanks very much. I fixed the models you mentioned manually, so those should be good in the next update. <img src="style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" />
 
Back
Top