• New Horizons on Maelstrom
    Maelstrom New Horizons


    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!

Low Priority Various problems in error.log

Added a CheckAttribute here to prevent error.log entries:
Code:
void AddGeometryToLocation(string LocationID, string ModelName)
{
   ref LocationRef;
   int n = 1;
   string str;
   locationRef = &locations[FindLocation(LocationID)];

   for(n = 1; n < 10; n++)
   {
     str = "l" + n; // PB: Elsewhere this uses "l1" and not just "1"; now this does too
     if(!CheckAttribute(LocationRef, "models.always." + str))
     {
       LocationRef.models.always.(str) = ModelName;
       LocationRef.models.always.(str).tech = "dLightModel";
       break;
     }
   }
}

void RemoveGeometryFromLocation(string LocationID, string ModelName)
{
   ref LocationRef;
   int n = 1;
   string str;
   if(FindLocation(LocationID) != -1)
   {
     locationRef = &locations[FindLocation(LocationID)];
   }
   else
   {
     return;
   }

   for(n = 1; n < 10; n++)
   {
     str = "l" + n; // PB: Elsewhere this uses "l1" and not just "1"; now this does too
     if(CheckAttribute(LocationRef, "models.always." + str)) // PB: Add CheckAttribute to avoid error logs
     {
       if(LocationRef.models.always.(str) == ModelName)
       {
         DeleteAttribute(LocationRef, "models.always." + str);
         break;
       }
     }
   }
}
Also added "l"+ for the sake of having this in line with more "normal" code.
 
Some error logs incase of interest:
RUNTIME ERROR - file: seadogs.c; line: 1391
invalid index -1 [size:1000]
RUNTIME ERROR - file: seadogs.c; line: 1391
process event stack error
RUNTIME ERROR - file: dialogs\Francois Chabert_dialog.c; line: 175
missed attribute: work
RUNTIME ERROR - file: dialogs\Francois Chabert_dialog.c; line: 175
no rAP data
RUNTIME ERROR - file: dialogs\Francois Chabert_dialog.c; line: 175
missed attribute: work
RUNTIME ERROR - file: dialogs\Francois Chabert_dialog.c; line: 175
no rAP data
COMPILE ERROR - file: dialogs\English\Debug.h; line: 1
Duplicate variable name: DLG_TEXT
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 100
invalid index 5 [size:5]
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 100
function 'CreateFlagEnvironment' stack error
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 100
invalid index 5 [size:5]
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 100
function 'CreateFlagEnvironment' stack error
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: dialog_func.c; line: 1545
Using reference variable without initializing
RUNTIME ERROR - file: dialog_func.c; line: 1545
Using reference variable without initializing
RUNTIME ERROR - file: dialog_func.c; line: 1545
AClass ERROR n1
RUNTIME ERROR - file: dialog_func.c; line: 1545
function 'GetMyFullName' stack error
RUNTIME ERROR - file: characters\characters.c; line: 133
Cant create class: NPCharacter
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: characters\characters.c; line: 133
Cant create class: NPCharacter
RUNTIME ERROR - file: characters\characters.c; line: 133
Cant create class: NPCharacter
RUNTIME ERROR - file: seadogs.c; line: 738
Ghost A reference
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: dialog_func.c; line: 1545
Using reference variable without initializing
RUNTIME ERROR - file: dialog_func.c; line: 1545
Using reference variable without initializing
RUNTIME ERROR - file: dialog_func.c; line: 1545
AClass ERROR n1
RUNTIME ERROR - file: dialog_func.c; line: 1545
function 'GetMyFullName' stack error
RUNTIME ERROR - file: characters\characters.c; line: 133
Cant create class: NPCharacter
RUNTIME ERROR - file: characters\characters.c; line: 133
Cant create class: NPCharacter
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: dialog_func.c; line: 1545
Using reference variable without initializing
RUNTIME ERROR - file: dialog_func.c; line: 1545
Using reference variable without initializing
RUNTIME ERROR - file: dialog_func.c; line: 1545
AClass ERROR n1
RUNTIME ERROR - file: dialog_func.c; line: 1545
function 'GetMyFullName' stack error
RUNTIME ERROR - file: dialog_func.c; line: 1545
Using reference variable without initializing
RUNTIME ERROR - file: dialog_func.c; line: 1545
Using reference variable without initializing
RUNTIME ERROR - file: dialog_func.c; line: 1545
AClass ERROR n1
RUNTIME ERROR - file: dialog_func.c; line: 1545
function 'GetMyFullName' stack error
RUNTIME ERROR - file: characters\characters.c; line: 133
Cant create class: NPCharacter
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 727
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 100
invalid index 5 [size:5]
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 100
function 'CreateFlagEnvironment' stack error
RUNTIME ERROR - file: Loc_ai\LAi_character.c; line: 296
missed attribute: chr_ai
RUNTIME ERROR - file: Loc_ai\LAi_character.c; line: 296
null ap
RUNTIME ERROR - file: Loc_ai\LAi_character.c; line: 296
no rAP data
RUNTIME ERROR - file: Loc_ai\LAi_events.c; line: 3345
invalid index -1 [size:1000]
RUNTIME ERROR - file: Loc_ai\LAi_events.c; line: 3345
process event stack error
RUNTIME ERROR - file: Loc_ai\LAi_character.c; line: 296
missed attribute: chr_ai
RUNTIME ERROR - file: Loc_ai\LAi_character.c; line: 296
null ap
RUNTIME ERROR - file: Loc_ai\LAi_character.c; line: 296
no rAP data
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 738
Save - ARef to non existing attributes branch
RUNTIME ERROR - file: seadogs.c; line: 1151
process event stack error
RUNTIME ERROR - file: seadogs.c; line: 118
process event stack error
 
This should fix the dialog error in there
 

Attachments

  • Francois Chabert_dialog.c
    7.8 KB · Views: 250
I got this error.log entry as part of the First Contact sidequest:
Code:
RUNTIME ERROR - file: Loc_ai\LAi_deck.c; line: 130
Invalid conversation

As shown in LAi_deck.c, this function takes a character INDEX as input, not a REFERENCE:
Code:
void Sea_DeckStartNow(int chridx, string deckname)
{
   bSeaReloadStarted = true;
   bToDeckFromLand = false; // KK

So this:
Code:
Sea_DeckStartNow(pchar, GetCharacterShipQDeck(PChar));
Should be this:
Code:
Sea_DeckStartNow(GetMainCharacterIndex(), GetCharacterShipQDeck(PChar));
Fixed now in all related situations. :doff
 
I'm getting the following errors with Build 14 Beta 4 WIP: 2 Apr 2016

Code:
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 103
invalid index 5 [size:5]
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 103
function 'CreateFlagEnvironment' stack error
RUNTIME ERROR - file: battle_interface\flags.c; line: 240
invalid index 5 [size:5]
RUNTIME ERROR - file: battle_interface\flags.c; line: 240
function 'SetShipFlag' stack error

And this one

RUNTIME ERROR - file: sea_ai\AIShip.c; line: 101
invalid index 7 [size:5]
RUNTIME ERROR - file: sea_ai\AIShip.c; line: 101
function 'CreateFlagEnvironment' stack error

My line numbers won't be the same as yours, because I've added traces to the code to find the problem.

I've got it narrowed down to these two lines:

AIShip.c
Code:
if (!IsEntity(&PirateFlag[ntexture])) {

flags.c
Code:
SendMessage(&PirateFlag[j], "lil", MSG_FLAG_INIT, &arModel, SHIP_FLAG);

and the problem appears to be caused by these lines from flags.c

Code:
for (j = 0; j < PIRATEFLAGS_TEXTURES_QUANTITY; j++)
{
    if (IsEntity(&PirateFlag[j])) SendMessage(&PirateFlag[j], "li", MSG_FLAG_DEL_GROUP, &arModel);
    if (IsEntity(&PiratePennant[j])) SendMessage(&PiratePennant[j], "li", MSG_FLAG_DEL_GROUP, &arModel);
}

I suspect that some changes to PirateFlag mess up the array structure for object PirateFlag[] to the point that the code can't determine the actual index. I've traced the index used and gotten an error on PirateFlag[2] that said the index was 5 in AIShip.c.

If the code produces a couple of lines in the error.log it doesn't appear to be a problem. But my problem is that I'm getting CTDs in sea_ai.dll without any indication of where the error is coming from, and I suspect it's part of the index-out-of-range problem or stack error problem that appears in some error logs that's somehow not being caught by the run time code.

The only way to reproduce this is to reload a saved game just before an island transition, where you log into a new sea, and this happens about every 5-10 times. Sometimes it happens when you go from the dock to your ship, but not often. New ships are created when you log in to the sea, and some combination of ships and flags is probably what causes the error to happen.

I had a CTD in one game where the compile.log didn't show any pirate ships present.

I have no choice but to look into this because of the CTDs. I can't guarantee I can fix the problem.

Hook
 
I just went through 25 compile logs from games that got the sea_ai.dll crash, and the crash doesn't appear to be related to the PirateFlag index problem. Many times pirates weren't involved, and a couple of times it looks like there were no other ships logged in.

The above information might help someone else track this down, if anyone is interested, but I doubt it's causing any major problems.

Hook
 
Thanks @Pieter Boelen, I hadn't seen that one yet. Useful information there.

I suspect something is being done in
Code:
SendMessage(&PirateFlag[j], "li", MSG_FLAG_DEL_GROUP, &arModel);

that causes
Code:
if (!IsEntity(&PirateFlag[ntexture])) {

to throw an error. I can pretty much guarantee that ntexture is a proper value. I've put checks and traces all over that code. I don't know if &PirateFlag[ntexture] points to an invalid location or if there's something that IsEntity() doesn't like. But since
SendMessage(&PirateFlag[j]... errored as well, it probably isn't IsEntity().

I'm gonna guess that the MSG_FLAG_DEL_GROUP message does something that changes PirateFlag[] in a way that makes an address like &PirateFlag[4] point outside the actual array data, so when the game looks at that address it thinks you've got an array index larger than the array is actually defined.

Look at DeleteFlagEnvironment() in AIShip.c for possible inspiration.

Hook
 
I posted a proposed fix in that other thread.
As far as I know, that does work as I don't remember anyone having that error log since then.
But I'd appreciate some conformation on that.
 
I found this error log this morning. No idea when it happened. Outside of many CTDs at Tortuga this game only crashed one time.
I seem to have a vague recollection of this one before:
Code:
RUNTIME ERROR - file: dialog.c; line: 414
incorrect argument index
As far as I know, it is "harmless". Did anything relating to the dialogs in the game seem to have gone wrong at the same time?
 
No, I don't remember anything going wrong.

I just looked and have new errors. I did kill a Maltese monk but it all went according to plan. I don't remember any oddities and there was only one random ctd.
 

Attachments

  • error.log
    702 bytes · Views: 199
Played again. Started in Havana then sailed to Port Royale, then Kralendijk. Bought and sold cargo, weapons and upgrades, and bought, upgraded, and berthed ships. I noticed nothing unusual but checked and have a large new error log. The game does seem to be running a little sluggish today as it seems to take a long time to load scenes and menus.
 

Attachments

  • error.log
    9.4 KB · Views: 233
Played again. Started in Havana then sailed to Port Royale, then Kralendijk. Bought and sold cargo, weapons and upgrades, and bought, upgraded, and berthed ships. I noticed nothing unusual but checked and have a large new error log. The game does seem to be running a little sluggish today as it seems to take a long time to load scenes and menus.
That is a LOT of weird stuff! I've got to admit I don't quite like the look of that one. :(

Could you delete your "options" file to see if that helps by any chance?
 
The game picked up later and is running normally now. I have no idea what those errors are all about.

I just finished the animist quest and the women at the governors mansion were cowering again. I checked and there is an error log that seems to be related to them.
 

Attachments

  • error.log
    169 bytes · Views: 205
@Hylie Pistof: what do you mean by "cowering again"? When did the women first start cowering?

When the quest finishes, they're supposed to walk away. All I changed there was to have them walk somewhere else - previously they'd walk in the general direction of the jungle gate and disappear very quickly, whereas now they're supposed to head for the port gate and have enough time to get there.

As for the error message, I'm going to have to play that quest again myself and find out what happens at the end. A quick check of "Unhappy women_dialog.c" indicates that this scene should never have worked, because this is line 49:
Code:
if (CheckQuestAttribute("ANIMISTS", "completed") && npchar.quest.ANIMISTS != "completed")
And the only place I can see attribute "npchar.quest.ANIMISTS" being set is at case "destroyed_sekt", which is triggered by the very block of dialog code controlled by that condition on line 49 - which means when you go to tell the women that you're returning their children, the dialog should always fail. And yet it doesn' t normally fail, because I've completed the quest and watched the ladies walk away, and presumably so have other people otherwise we'd have seen lots more reports before. o_O
 
When I started the Animist quest by walking up to the women in front of the Governors mansion all 3 of them were cowering. I tried to talk to them and 2 of them stood up and replied, but one remained cowering. When I went by there on other business while the quest was running they were all standing. Then when I finally completed it and returned 2 were standing and 1 was cowering. When I talked to them they all walked to the front gate, but if I left the area too fast when I returned they would be there and started walking to the front gate again. The 3rd time I followed them all the way to the gate where they disappeared. That finished the quest for them.
 
Back
Top