I found the code that causes this problem. It's actually NOT what I posted above, though it does look very similar.
It's in PROGRAM\SEA_AI\AIShip.c:
There's actually code in place there to PREVENT stuff like this happening for the Pearl and other ships that have 100000 HP points.
However, the randomization going on at Vanderdecken shipyard prevents this code from doing what it should, therefore introducing our problem.
There's two ways to fix this:
1. Change this code so that ANY ship with excessive HP values (even if it's not exactly 1000000) is "exempt" of the crew requirement.
This will be the easy way, since we can instantly do this.
2. Find the code that randomizes the Vanderdecken ship stats.
This'll be tricky, because I'm not sure where to search...
It's in PROGRAM\SEA_AI\AIShip.c:
Code:
void Ship_SetCannonQtyByCrew(ref rCharacter)
{
//bool ismch = sti(rCharacter.index) == GetMainCharacterIndex();
if(!GetCannonQuantity(&rCharacter)) return;
aref arship; makearef(arship, rCharacter.ship);
if (bRealBattleInterface == false && GetCharacterIndex(rCharacter.id) == GetMainCharacterIndex()) Event("evntUpdateCannonInfo"); // KK
// LDH set min crew ratio to number of crew actually required to load one broadside - 12May09 -->
ref rCannon = GetCannonByType(sti(rCharacter.Ship.Cannons.Type));
float CrewPerGun = stf(rCannon.caliber);
if (rCannon.type == CANNON_NAME_LONG)
CrewPerGun /= 2.0; // 12 pounder takes 6 crew, for example
else
CrewPerGun /= 6.0; // carronades take fewer crew and are normally twice the caliber of the long guns they replace
// Note that if the player doesn't have USE_REAL_CANNONS set, the CrewPerGun is divided by 6 as well
CrewPerGun = fclamp(1.0, 10.0, CrewPerGun); // gun crew no less than 1 and no more than 10
int iCanQty = GetCannonQuantity(&rCharacter);
float CrewRequired = CrewPerGun * iCanQty;
CrewRequired /= 2.0; // We're only loading one broadside at a time.
if (CrewRequired < 1) CrewRequired = 1;
int CrewQuantity = GetCrewQuantity(rCharacter);
if (USE_MINSAILCREW)
{
int MinSailCrew = GetCharacterShipHP(rCharacter)/100; // crew needed for sailing, intentionally not using mininum crew here
if (MinSailCrew == 100000/100) MinSailCrew = 100; // Black Pearl is a special case
CrewQuantity -= MinSailCrew;
}
if (CrewQuantity < CrewPerGun) CrewQuantity = CrewPerGun; // detail one gun crew from the MinSailCrew
However, the randomization going on at Vanderdecken shipyard prevents this code from doing what it should, therefore introducing our problem.
There's two ways to fix this:
1. Change this code so that ANY ship with excessive HP values (even if it's not exactly 1000000) is "exempt" of the crew requirement.
This will be the easy way, since we can instantly do this.
2. Find the code that randomizes the Vanderdecken ship stats.
This'll be tricky, because I'm not sure where to search...