Also, if you have a savegame just PRIOR to selling the goods, that could be a nice testing case to check what is happening here.
This is the related code from PROGRAM\DIALOGS\Smuggler_OnShore_dialog.c:
GetSquadronGoods automatically checks all ships in your fleet:
And RemoveCharacterGoods affects all ships in the fleet too:
So if I understand correctly from that code, if the cargo got removed from your player ship, that same function should have affected your companions too.
Unless those companions are "locked" or are traders, of course.
But if they're "locked", you shouldn't even have been able to put the contraband ON their ships.
And characters are only considered "traders" based on one very specific officer type:
But that should only ever get applied to one single character ID in the game, the "Quest trader" who joins you for the Escort Quests.
In other words: I don't get it.
This is the related code from PROGRAM\DIALOGS\Smuggler_OnShore_dialog.c:
Code:
case "Leave_goods":
int total_smuggle = 0;
int goods_index = FindFirstContrabandGoods(Pchar);
if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip1"))
{
total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
}
goods_index = FindNextContrabandGoods(Pchar);
if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip2"))
{
total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
}
goods_index = FindNextContrabandGoods(Pchar);
if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip3"))
{
total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
}
goods_index = FindNextContrabandGoods(Pchar);
if(goods_index != -1 && !CheckAttribute(Pchar,"quest.Contraband.Skip4"))
{
total_smuggle = total_smuggle + GetSquadronGoods(Pchar,goods_index);
RemoveCharacterGoods(Pchar, goods_index, GetSquadronGoods(Pchar, goods_index));
}
GetSquadronGoods automatically checks all ships in your fleet:
Code:
int GetSquadronGoods(ref _refCharacter,int _Goods)
{
int i,cn;
ref chref;
int retVal = GetCargoGoods(&_refCharacter,_Goods);
for(i=1; i<4; i++)
{
cn = GetCompanionIndex(&_refCharacter,i);
if(cn!=-1)
{
chref = GetCharacter(cn);
if (IsTrader(chref)) continue; // KK
if( GetRemovable(chref) || _Goods == GOOD_WHEAT || _Goods == GOOD_RUM) // LDH 13Oct06 fix for quest ships
{
retVal = retVal + GetCargoGoods(chref,_Goods);
}
}
}
return retVal;
}
Code:
int RemoveCharacterGoods(ref _refCharacter,int _Goods,int _Quantity)
{
int i,cn,curQuantity;
string goodsName = Goods[_Goods].name;
for (i=0; i < 4; i++)
{
cn = GetCompanionIndex(_refCharacter,i);
if(cn!=-1)
{
if (IsTrader(GetCharacter(cn))) continue; // KK
curQuantity = sti( Characters[cn].Ship.Cargo.Goods.(goodsName) );
if(curQuantity>=_Quantity)
{
Characters[cn].Ship.Cargo.Goods.(goodsName) = curQuantity - _Quantity;
RecalculateCargoLoad(&Characters[cn]);
return true;
}
Characters[cn].Ship.Cargo.Goods.(goodsName) = 0;
_Quantity = _Quantity - curQuantity;
RecalculateCargoLoad(&Characters[cn]);
}
}
Trace("Overup cargo space on "+_Quantity);
return false;
}
So if I understand correctly from that code, if the cargo got removed from your player ship, that same function should have affected your companions too.
Unless those companions are "locked" or are traders, of course.
But if they're "locked", you shouldn't even have been able to put the contraband ON their ships.
And characters are only considered "traders" based on one very specific officer type:
Code:
bool IsTrader(ref _refCharacter)
{
int findIdx = -1; // KK
if (CheckAttribute(_refCharacter, "index"))
findIdx = sti(_refCharacter.index); // changed by MAXIMUS
else
return false;
// PB: Just check single character officer type -->
if (GetAttribute(_refCharacter, "quest.officertype") == OFFIC_TYPE_TRADER) return true;
else return false;
// PB: Just check single character officer type <--
/*
// PB: What was this supposed to be doing?
ref mc = GetMainCharacter();
for (int i = 1; i < 4; i++)
{
if (GetCompanionIndex(mc, i) == findIdx && CheckAttribute(&Characters[findIdx], "quest.officertype") == true && Characters[findIdx].quest.officertype == OFFIC_TYPE_TRADER) return true;
}
return false;
*/
}
In other words: I don't get it.