@Pieter Boelen oh there are vitual smugglers! you just don't know them
.
Every day during the island update there is a small chance for an island a smuggler drops by and delivers some goods or they might get caught. This will make sure the smuggling state of the islands are a little bit dynamic.
The Force_GetShipType from this function is probably causing the problem because an island has the pirate smuggling nation. But I'm not 100% sure it's this. But this one I could imagine being the cause.
Looking at it again it does look a bit weird with maxclass being 7 but minclass being a random number between 0 and 20 .. that doesn't sound right

Code:
if(rand(1000)<=SMUGGLING_AMOUNT_INCR_CHANCE)
{
//See if they get caught
if(pow2(sisland.smuggling.state,2)<=rand(16))
{
if(CheckAttribute(sisland,"Trade.Contraband"))
{
//Make a smuggler who adds some goods to the island
if(DEBUG_SMUGGLING>0) trace("SMUGGLING smuggler visited "+sisland.id);
int iShipType, iCargoType, iTradeGoods, irank;
if(CheckAttribute(sisland,"smuggler.ship")) DeleteAttribute(sisland,"smuggler.ship");
iShipType = Force_GetShipType(7, rand(20), "trade", sti(sisland.smuggling_nation));
sisland.smuggler.ship.type = GetShipID(iShipType);
int contid = rand(getIslandAmountContraband(sisland)-1)+1;//to make sure the rand() wont give 0
string contrabandid = "id" + contid;
iTradeGoods = sisland.Trade.Contraband.(contrabandid);
aref smuggler;
makearef(smuggler,sisland.smuggler);
int hullspace = GetCharacterFreeSpace(smuggler, iTradeGoods);
//Only 60% of space is used
int smuggle_amount = hullspace*0.6;
addIslandSmugglingAmount(sisland, smuggle_amount);
}
}
}
}
Every day during the island update there is a small chance for an island a smuggler drops by and delivers some goods or they might get caught. This will make sure the smuggling state of the islands are a little bit dynamic.
The Force_GetShipType from this function is probably causing the problem because an island has the pirate smuggling nation. But I'm not 100% sure it's this. But this one I could imagine being the cause.
Looking at it again it does look a bit weird with maxclass being 7 but minclass being a random number between 0 and 20 .. that doesn't sound right