Thanks for confirming!Confirmed, the original version does not work properly. I added a couple of trace statements: if 'GetCompanionIndex(rPlayer, c)' was positive then show the character's name, otherwise show the slot number of the faulty captain. As I have a savegame in a port where a couple of ships are berthed, I relaunched one of them into slot 3 (the relaunch interface calls it slot 4 because it counts from 1). Then I put to sea, quit, and checked "compile.log". It did exactly what I expected. 'GetCompanionQuantity(rPlayer)' is 2 (me plus one companion), so it cycled from 0 to 2, reported my name, reported slots 1 and 2 as faulty, and didn't report slot 3 at all.
Looks like there are a couple other spots where the same thing might happen then.
PROGRAM\Characters\Levelling.c:
Code:
//Now handle the companions
if(group == XP_GROUP_PARTY)
{
capt = GetCharacter(FindCommanderIndex(chref)); // Get the commander of the fleet
for (i = 0; i <= GetCompanionQuantity(capt); i++) {
cn = GetCompanionIndex(capt, i);
if (cn < 0) continue;
chr = GetCharacter(cn); // Reference to the character
PROGRAM\WorldMap\DailyCrewUpdate.c:
Code:
for (i = 0; i < GetCompanionQuantity(pchar); i++) {
chref = GetCharacter(GetCompanionIndex(GetMainCharacter(), sti(i)));
if(CheckCharacterItem(chref,"cursedcoin"))
{
if(!CheckAttribute(chref, "curseddays")) chref.curseddays = 0;
chref.curseddays = sti(chref.curseddays) + 1;
}
}
PROGRAM\SEA_AI\AIShip.c:
Code:
for (int i = 1; i < GetCompanionQuantity(GetMainCharacter()); i++) {
ch = GetCharacter(GetCompanionIndex(GetMainCharacter(), i));
if(rOurCharacter.index == ch.index)
{
loc = &locations[FindLocation("Companion_Cabin_"+i)];
}
}
}
PROGRAM\NK.c:
Code:
bool KrakenAttackEnabled()
{
ref pchar = GetMainCharacter();
ref ch;
if(CheckAttribute(pchar, "KrakenAttack")) return false; // No Kraken attack is available until a set time after the previous attack
if(CheckAttribute(pchar, "ship.SubmergeDutchman")) return false; // No Kraken attack is available while the Dutchman is submerged
for (int i = 0; i <= GetCompanionQuantity(PChar); i++) {
ch = GetCharacter(GetCompanionIndex(pchar, sti(i)));
if(GetAttribute(ch, "ship.type") == "CursedDutchman") return true; // Only the CURSED Flying Dutchman can call upon the Kraken
}
return false;
}
