1. Dismiss Notice
  2. GOG.com logo

    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!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Fixed GetPatrolTimeText Can Cause Crashes

Discussion in 'Bug Archive' started by Mere_Mortal, May 27, 2016.

  1. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    Free-play as a pirate, currently at Turks. Guaranteed crash if I talk to anybody other than the barman in the tavern.
    Code:
    RUNTIME ERROR - file: smuggling.c; line: 962
    incorrect argument index
    RUNTIME ERROR - file: smuggling.c; line: 962
    Bad function argument
    RUNTIME ERROR - file: smuggling.c; line: 963
    missed attribute: start
    RUNTIME ERROR - file: smuggling.c; line: 963
    no rAP data
    RUNTIME ERROR - file: smuggling.c; line: 964
    missed attribute: end
    RUNTIME ERROR - file: smuggling.c; line: 964
    no rAP data
    
    Code:
    string GetPatrolTimeText(ref sisland, int best)
    {
       aref patrols;
       makearef(patrols,sisland.smuggling.patrol);
       string patrol = GetAttributeName(GetAttributeN(patrols,best));
       string start = GetTimeText(stf(sisland.smuggling.patrol.(patrol).start));
       string end = GetTimeText(stf(sisland.smuggling.patrol.(patrol).end));
       string text = "between "+start+" and "+end;
       return text;
    }
    
    I placed a return at the top of the function and I can now speak to people.
     
  2. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Do you have a save from which I can test this?
    It may be a quick fix, but I'm not near my computer for a few days so can't look into it yet at the moment.
     
  3. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    It seems to depend on the dialogue options as to whether or not it crashes - I think it will if somebody will actually talk to me.
    Speaking to the barman is okay, so what does appear to be consistent is spawning an officer and then attempting to talk to him.
     

    Attached Files:

    Pieter Boelen likes this.
  4. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    There should be only two types of characters who use that function in their dialog:
    Officers and soldiers in the Tavern.
     
  5. llewelyn ravencroft

    llewelyn ravencroft Sailor Apprentice

    Joined:
    May 16, 2015
    Messages:
    69
    Gender:
    Male
    about that every time i talk to my officers on cozumel and on the landing I get this upload_2016-5-30_14-17-12.png
     

    Attached Files:

  6. llewelyn ravencroft

    llewelyn ravencroft Sailor Apprentice

    Joined:
    May 16, 2015
    Messages:
    69
    Gender:
    Male
    and here are the other two logs
     

    Attached Files:

  7. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Moved your post here as it seems to be the same issue.
     
  8. llewelyn ravencroft

    llewelyn ravencroft Sailor Apprentice

    Joined:
    May 16, 2015
    Messages:
    69
    Gender:
    Male
    thanks
     
  9. llewelyn ravencroft

    llewelyn ravencroft Sailor Apprentice

    Joined:
    May 16, 2015
    Messages:
    69
    Gender:
    Male
    Pieter do you want my save?
     
  10. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    You're welcome to post it. :doff
     
  11. llewelyn ravencroft

    llewelyn ravencroft Sailor Apprentice

    Joined:
    May 16, 2015
    Messages:
    69
    Gender:
    Male
    Here my Cozumel save
     

    Attached Files:

    Pieter Boelen likes this.
  12. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    @Mere_Mortal and @llewelyn ravencroft: I think I know why the game would crash there.
    In MM's savegame, Turks is PIRATE and therefore has NO smuggling patrols defined. Likewise, there isn't much to smuggle on Cozumel either.

    I think this change in PROGRAM\smuggling.c should prevent any errors due to this:
    Code:
    string GetPatrolTimeText(ref sisland, int best)
    {
       aref patrols;
       makearef(patrols,sisland.smuggling.patrol);
       if (GetAttributesNum(patrols) > 0) // PB: Just in case there are no patrols at all
       {
         string patrol = GetAttributeName(GetAttributeN(patrols,best));
         string start  = GetTimeText(stf(sisland.smuggling.patrol.(patrol).start));
         string end  = GetTimeText(stf(sisland.smuggling.patrol.(patrol).end));
         return "between "+start+" and "+end;
       }
       return "";
    }
    
    See attached for my copy of the file. :doff

    EDIT: Confirmed, this solves the problem.
     

    Attached Files:

    Mere_Mortal likes this.
  13. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    Soldiers patrolling in pirate town would be bad for their health. :yes
     
  14. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    There can actually be Smuggling patrols on pirate Islands too. But not if the Smuggling Nation of that Island is also pirate.
    This is to simulate the idea that another nation may claim ownership over an island, even if they themselves have no settlement there.
     
  15. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    Ah, that makes a better sense. Still bad for their health, though. xD
     
  16. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    If you play in Early Explorers, then often Spain is the "Smuggling Nation" for islands, even if Spain has no settlement there.
    This often affects Turks. Also with England in the later time periods.
     
  17. lucho1392

    lucho1392 Sailor Apprentice

    Joined:
    Jun 27, 2015
    Messages:
    91
    Gender:
    Male
    Occupation:
    Database Administrator
    Location:
    Costa Rica
    Hey mates been a while since last time I wrote something around here. Well have been playing the newest Mod version and it always radomly crashes. It's kind of annoying but try to avoid any stress by quicksaving a LOT.

    Is this normal or is just my pc or my stock game or IDK.

    Edit: Was playing in free play with Master & Commander. Now playing the main story.

    Save: MEGA
     

    Attached Files:

    Last edited: Jun 13, 2016
  18. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    What latest game version are you talking about? Post all the .log files from your main game folder after it happens.

    Also, I'm moving this to the "Support" forum as without any details, this is no actual bug report.
     
  19. lucho1392

    lucho1392 Sailor Apprentice

    Joined:
    Jun 27, 2015
    Messages:
    91
    Gender:
    Male
    Occupation:
    Database Administrator
    Location:
    Costa Rica
  20. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,593
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    AoP is a different game altogether. :confused:

    I see attachments now, but why is there no "compile.log"? There must be one!

    The error.log you show looks familiar. See here:
    Fixed - GetPatrolTimeText Can Cause Crashes | PiratesAhoy!
     

Share This Page