@Pieter Boelen you can probably remove this check from the while loop then .
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!
Quick links for Beyond New Horizons
- Download latest version
- Wiki
- FAQ
- Report bugs here
- Bug Tracker on Github
Quick links for Maelstrom
- Download the latest version of Maelstrom
- Download the latest version of ERAS II
- Download the latest version of New Horizons on Maelstrom
Quick links for PotC: New Horizons
- Download latest version
- Wiki
- FAQ
- Report bugs here
Thanks to YOUR votes, GOG.com now sells:
- Sea Dogs
- Sea Dogs: Caribbean Tales
- Sea Dogs: City of Abandoned Ships
Vote now to add Pirates of the Caribbean to the list!
Quick links for AoP2: Gentlemen of Fortune 2
- Downloads and info
- ModDB Profile
- Forums Archive
A Pirate Podcast with Interviews
Music, Comedy and all things Pirate!
- Episode Guide - About - Subscribe -
- Twitter - Facebook - iTunes - Android -
- Youtube - Fill the Coffers -
int GenerateGoodForTrade(int FromNat, int ToNat, ref fromprice, ref toprice) // NK add prices 05-05-12
{
//int fstoreidx = GetTownStoreIndex(GetTownIDFromGroup(Stores[GetCharacterCurrentStore(GetMainCharacter())].group));
int fstoreidx = GetTownStoreIndex(GetCurrentTownID());
//trace("from " + fstoreidx + " of " + GetCurrentTownID());
string destCol;
string friendlyTowns = "";
for(int j=0; j<TOWNS_QUANTITY; j++)
{
if(!CheckAttribute(&Towns[j],"id")) continue;
if(!CheckAttribute(&Towns[j],"nation")) continue;
if(CheckAttribute(&Towns[j],"skiptrade") && Towns[j].skiptrade==true) continue;//MAXIMUS: added for some towns (such as St. John's on Antigua)
if(Towns[j].nation!=ToNat) continue;
friendlyTowns = StoreString(friendlyTowns,Towns[j].id);
}
if(friendlyTowns!="")
{
destCol = GetRandSubString(friendlyTowns);
while(destCol=="" || HasSubStr(destCol,",") || GetIslandIDFromTown(destCol)==GetIslandIDFromTown(GetCurrentTownId())) { destCol = GetRandSubString(friendlyTowns); }
}
else
{
switch (ToNat)
{
case FRANCE: destCol = FRA_COLONY; break;
case SPAIN: destCol = SPA_COLONY; break;
case HOLLAND: destCol = HOL_COLONY; break;
case PORTUGAL: destCol = POR_COLONY; break;
case ENGLAND: destCol = RED_COLONY; break;
}
}
int GenerateGoodForTrade(int FromNat, int ToNat, ref fromprice, ref toprice) // NK add prices 05-05-12
{
//int fstoreidx = GetTownStoreIndex(GetTownIDFromGroup(Stores[GetCharacterCurrentStore(GetMainCharacter())].group));
int fstoreidx = GetTownStoreIndex(GetCurrentTownID());
//trace("from " + fstoreidx + " of " + GetCurrentTownID());
string destCol;
string friendlyTowns = "";
for(int j=0; j<TOWNS_QUANTITY; j++)
{
if(!CheckAttribute(&Towns[j],"id")) continue;
if(!CheckAttribute(&Towns[j],"nation")) continue;
if(CheckAttribute(&Towns[j],"skiptrade") && Towns[j].skiptrade==true) continue;//MAXIMUS: added for some towns (such as St. John's on Antigua)
if(Towns[j].nation!=ToNat) continue;
if(GetIslandIDFromTown(Towns[j].id) == GetIslandIDFromTown(GetCurrentTownID())) continue;
friendlyTowns = StoreString(friendlyTowns,Towns[j].id);
}
if(friendlyTowns!="")
{
destCol = GetRandSubString(friendlyTowns);
while(destCol=="" || HasSubStr(destCol,",")) { destCol = GetRandSubString(friendlyTowns); }
}
else
{
switch (ToNat)
{
case FRANCE: destCol = FRA_COLONY; break;
case SPAIN: destCol = SPA_COLONY; break;
case HOLLAND: destCol = HOL_COLONY; break;
case PORTUGAL: destCol = POR_COLONY; break;
case ENGLAND: destCol = RED_COLONY; break;
}
}
string GenerateTradeQuest(ref pchar, int iTradeNation, int iTradeGoods, float fprice, float tprice, bool bMain)// moved here from traders dialogs
{
int i, iQuantityGoods, iMoney, iTradeExp, iDaysExpired, chridx;
float fDistance, fWeight, pricediff;
string sTown = "";
//MAXIMUS -[such functions must be universal (IMHO), if we are planning to make a real Caribbean in the future]->
string friendlyTowns = "";
string pirateTowns = "";
ref chr;
for(i = 0; i < TOWNS_QUANTITY; i++)
{
if(!CheckAttribute(&Towns[i],"id")) continue;
if(!CheckAttribute(&Towns[i],"nation")) continue;
if(GetAttribute(&Towns[i],"skiptrade") == true) continue;//MAXIMUS: added for some towns (such as St. John's on Antigua)
if(sti(Towns[i].nation) != iTradeNation) continue;
friendlyTowns = StoreString(friendlyTowns,Towns[i].id);
}
if (friendlyTowns != "") {
sTown = GetRandSubString(friendlyTowns);
while (sTown == "" || HasSubStr(sTown, ",") || GetIslandIDFromTown(sTown) == GetIslandIDFromTown(GetCurrentTownId()))
{
sTown = GetRandSubString(friendlyTowns);
}
} else {
sTown = "Quebradas Costillas"; //MAXIMUS: Quebradas Costillas - why some trader can't trade with pirates?
}
string GenerateTradeQuest(ref pchar, int iTradeNation, int iTradeGoods, float fprice, float tprice, bool bMain)// moved here from traders dialogs
{
int i, iQuantityGoods, iMoney, iTradeExp, iDaysExpired, chridx;
float fDistance, fWeight, pricediff;
string sTown = "";
//MAXIMUS -[such functions must be universal (IMHO), if we are planning to make a real Caribbean in the future]->
string friendlyTowns = "";
string pirateTowns = "";
ref chr;
for(i = 0; i < TOWNS_QUANTITY; i++)
{
if(!CheckAttribute(&Towns[i],"id")) continue;
if(!CheckAttribute(&Towns[i],"nation")) continue;
if(GetAttribute(&Towns[i],"skiptrade") == true) continue;//MAXIMUS: added for some towns (such as St. John's on Antigua)
if(sti(Towns[i].nation) != iTradeNation) continue;
if(GetIslandIDFromTown(Towns[i].id) == GetIslandIDFromTown(GetCurrentTownID())) continue;
friendlyTowns = StoreString(friendlyTowns,Towns[i].id);
}
if (friendlyTowns != "") {
sTown = GetRandSubString(friendlyTowns);
while (sTown == "" || HasSubStr(sTown, ","))
{
sTown = GetRandSubString(friendlyTowns);
}
} else {
sTown = "Quebradas Costillas"; //MAXIMUS: Quebradas Costillas - why some trader can't trade with pirates?
}
Already done.@Pieter Boelen you can probably remove this check from the while loop then .
You DID actually say that. I just didn't notice until I tested the problem, couldn't replicate it, and then re-read your initial report.I should have clarified that it only happens around 50% of the time, luckily it seems you smart fellows have figured everything out!
Done: Planned Feature - Rework Cargo Quest Logic | PiratesAhoy!@Pieter Boelen could you make a build 15 topic about this so we can then take a good look at it?
If I'm going to revamp the trading system I want to take this into account too.
Yes, you should!Should we go ahead and use Pieter's quickfix for the crash in the meantime?
I can confirm it because I tested it before posting.Can someone confirm the bug is solved?