But where is that ProcessSailRepair itself?
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 -
BattleInterface.cBut where is that ProcessSailRepair itself?
Not sure, I didn’t finish the boarding so I have no idea if the rest of the fleet had surrendered. However, since there was only two pirates, possibly Sloops, against 6 heavy warships, including my own flying British colours as well, their morale should have been very good. Hoisting would probably have some kind of effect, but since they had twice the power that I had it doesn’t really make sense. I literally just pulled up alongside and hoisted, giving me the boarding option.Maybe they had a low morale and surrendered? But then you should have gotten the dialog. Bit strange....
I have no access to my game files right now, otherwise I could have looked that up myself.BattleInterface.c
In that case, I do not know.Not sure, I didn’t finish the boarding so I have no idea if the rest of the fleet had surrendered. However, since there was only two pirates, possibly Sloops, against 6 heavy warships, including my own flying British colours as well, their morale should have been very good. Hoisting would probably have some kind of effect, but since they had twice the power that I had it doesn’t really make sense. I literally just pulled up alongside and hoisted, giving me the boarding option.
void ProcessDayRepair()
{
//trace("Gauging: NEXTDAY_start PDR");
int i, cn;
float matQ, tmpf, repPercent;
ref chref;
for(i=0; i<4; i++)
{
cn = GetCompanionIndex(GetMainCharacter(),i);
if(cn==-1) continue;
chref = GetCharacter(cn);
RepairAllCannons(&chref); // NK can qty. For now repair all fixable guns. Later go back and set repair rates. 05-04-19
// расчет починки корпуса
if( GetHullPercent(chref)<100.0 )
{
repPercent = GetHullRPD(chref);
matQ = repPercent*GetHullPPP(chref);
tmpf = GetRepairGoods(true,chref);
if(tmpf<matQ) { repPercent = tmpf/GetHullPPP(chref); }
repPercent = ProcessHullRepair(chref,repPercent);
matQ = repPercent*GetHullPPP(chref);
RemoveRepairGoods(true,chref,matQ);
}
// расчет починки парусов
if( GetSailPercent(chref)<100.0 )
{
repPercent = GetSailRPD(chref);
matQ = repPercent*GetSailSPP(chref);
tmpf = GetRepairGoods(false,chref);
if(tmpf<matQ) { repPercent = tmpf/GetSailSPP(chref); }
repPercent = ProcessSailRepair(chref,repPercent);
matQ = repPercent*GetSailSPP(chref);
RemoveRepairGoods(false,chref,matQ);
}
}
//trace("Gauging: NEXTDAY_end PDR");
}
bool CheckInstantRepairCondition(ref chref)
{
//int tmpLangFileID = LanguageOpenFile("interface_strings.txt");
//boal -->
//if(!GetCharacterPerkUsing(chref,"InstantRepair")) return false;
//ccc realistic shipyard repair at anchorage only->
// LDH 02Oct06
if(!bMapEnter) return false;
//ccc repair <-
/*bool retRepair = GetCharacterPerkUsing(chref,"InstantRepair");
if(!retRepair)
{
int cn;
for(int i=1; i<4; i++)
{
cn = GetOfficersIndex(chref,i);
if(cn!=-1)
{
if(GetCharacterPerkUsing(GetCharacter(cn),"InstantRepair"))
{
retRepair = true;
break;
}
}
}
}*/ // ASVS commented that out, see below.
if(!GetOfficersPerkUsing(chref,"InstantRepair")) //ASVS - come on, we have a function for that, why not using it?
return false;
//boal <--
if(GetHullPercent(chref) < 90.0 && GetCargoGoods(chref, GOOD_PLANKS) > 0) return true;
return GetSailPercent(chref) < 90.0 && GetCargoGoods(chref, GOOD_SAILCLOTH) > 0;
}
if(GetHullPercent(chref) < 90.0 && GetCargoGoods(chref, GOOD_PLANKS) > 0) return true;
return GetSailPercent(chref) < 90.0 && GetCargoGoods(chref, GOOD_SAILCLOTH) > 0;
if(GetHullPercent(chref) < 90 && GetCargoGoods(chref, GOOD_PLANKS) > 0) return true;
if(GetSailPercent(chref) < 90 && GetCargoGoods(chref, GOOD_SAILCLOTH) > 0) return true;
Okay, I don’t know where it is but I’ll have a good look.repPercent = ProcessSailRepair(chref,repPercent);
Program\BattleInterface\utils.c said:float ProcessSailRepair(ref chref, float repPercent)
{
if (repPercent == 0.0) return 0.0; // LDH out of sailcloth - 25Feb09
float dmg = 100.0-GetSailPercent(chref);
if(dmg==0.0) return 0.0;
if(repPercent>dmg) repPercent=dmg;
float fMakeRepair = repPercent;
int i,j,rq,gq;
aref arRoot,arGroup,arSail;
string tmpstr;
makearef(arRoot, chref.ship.sails);
rq = GetAttributesNum(arRoot);
for(i=0; i<rq; i++)
{
arGroup = GetAttributeN(arRoot, i);
gq = GetAttributesNum(arGroup);
for(j=0; j<gq; j++)
{
arSail = GetAttributeN(arGroup, j);
if( CheckAttribute(arSail,"mastFall") )
{
tmpstr = "ship.masts."+arSail.mastFall;
if( CheckAttribute(chref,tmpstr) && stf(chref.(tmpstr))>=1.0 ) {continue;}
}
fMakeRepair -= OneSailDmgRepair(chref,arGroup,arSail,fMakeRepair);
if(fMakeRepair<=0.0) {break;}
if(!CheckAttribute(chref,"ship.sails")) break;
if(GetAttributesNum(arRoot)!=rq) break;
if(GetAttributesNum(arGroup)!=gq)
{
gq = GetAttributesNum(arGroup);
j--;
}
}
if(fMakeRepair<=0.0) {break;}
if(!CheckAttribute(chref,"ship.sails")) break;
if(GetAttributesNum(arRoot)!=rq)
{
rq = GetAttributesNum(arRoot);
i--;
}
}
chref.ship.sp = CalculateShipSP(chref); // Note: this is wrong for tutorial, damage isn't set correctly on tutorial ship - 25Feb09
// LDH add repair skill for repairs - 21Jan09
// This will add skill for repairs done at shipyard. This is intentional.
if (AUTO_SKILL_SYSTEM)
{
if (sti(chref.index) == GetMainCharacterIndex()) // LDH 24Jan09
Trace("Repair & Defence skill added in ProcessSailRepair: " + repPercent + " actual " + makeint(repPercent + 0.5));
int AddSkill = makeint(repPercent + 0.5); if (AddSkill < 20) AddSkill = 20;
AddPartyExpChar(chref, "Repair", AddSkill));
AddPartyExpChar(chref, "Defence", AddSkill);
}
return repPercent;
}
void ProcessDayRepair()
{
//trace("Gauging: NEXTDAY_start PDR");
int i, cn;
void ProcessDayRepair()
{
trace("Gauging: NEXTDAY_start PDR");
return;
int i, cn;
float ProcessSailRepair(ref chref, float repPercent)
{
if (repPercent == 0.0) return 0.0; // LDH out of sailcloth - 25Feb09
float ProcessSailRepair(ref chref, float repPercent)
{
return 0.0;
if (repPercent == 0) return 0 ;
Simple; you add a line Trace("Whatever you want"); and when the game code passes that line, "Whatever you want" gets written to compile.log .I don’t know how the tracing works.
If I recall, normally that would show in error.log as "divide by zero" error.If this is true then I’m wondering if there is a division-by-zero taking place.
Could indeed be. Use Trace to find out how far the code gets before crashing; that should tell us more.Well... I guess that depends on whether or not the game catches the error. End of the day, if it’s a buffer under/overrun then the game could be exiting before it has had a chance to log the problem. Maybe that is precisely why there never seems to be anything in the logs about this error? I guess the system will say one of two things: “Nope, that’s an error and I can’t continue because...”, or it will be like, “MAYDAY!!”.
COMPILE ERROR - file: battle_interface\utils.c; line: 208
Invalid Expression
BattleInterface.c said:float sailDmg = 0.0;
float sailDmgMax = GetCharacterShipSP(chref) * sailPower;
if( !CheckAttribute(arSail,"dmg") ) { sailDmg = 0.0; }
trace("getShip: "+GetCharacterShipSP(chref))
trace("sailDmg: "+sailDmg)
trace("sailDmgMax: "+sailDmgMax)
trace("sailPower: "+sailPower)
That, there, is a very odd number. So now I wonder if this is causing an overflow because the number is too large for memory, or it is being converted to zero and thus causing a division-by-zero somewhere along the lines.compile.log said:getShip: 200
sailDmg: 0.
sailDmgMax: 33.832
sailPower: 0.16916
getShip: 200
sailDmg: 0.
sailDmgMax: 20.86
sailPower: 0.1043
getShip: 200
sailDmg: 0.
sailDmgMax: 14.591
sailPower: 7.2954e-002
getShip: 200
sailDmg: 0.
sailDmgMax: 91.625
sailPower: 0.45813
getShip: 200
sailDmg: 0.
sailDmgMax: 39.092
sailPower: 0.19546
There were lots of them, these are but a few. It’d be no wonder if numbers like these are causing problems.trying to spawn item: medical1 with rarity=6.0364e-002 itemProb=0.96
trying to spawn item: roseskull with rarity=0.41241 itemProb=6.e-002
trying to spawn item: skillbook2 with rarity=0.36389 itemProb=2.4e-002
trying to spawn item: jewelry16 with rarity=0.11673 itemProb=2.4e-002
trying to spawn item: jewelry1 with rarity=0.88385 itemProb=6.e-002
trying to spawn item: pistolmket with rarity=7.7637e-002 itemProb=6.e-002
trying to spawn item: chinatiger with rarity=0.74936 itemProb=3.6e-002
“Sail ahoy, cap’n!
“How many decks?”
“Err... none, cap’n!”
I think the game engine does that so that when you return to 3D Sailing Mode, all ships are still in place.Also, look at the screen shot.
Instead of removing those lines, I'd propose this instead:While this effectively breaks the sail repairs, I can only assume, it seems to be doing something to stop the crashes.
void ProcessDayRepair()
{
//trace("Gauging: NEXTDAY_start PDR");
if( bSeaActive && bAbordageStarted ) return; // <------------- Abort this function during boarding -----------------
int i, cn;
void procActionRepair()
{
int chrIdx = GetEventData();
int eRepType = GetEventData();
if(chrIdx<0) return;
if(!bSeaActive) return;
if( bAbordageStarted) return; // <------------- And this one too -----------------
ref chref = GetCharacter(chrIdx);