1. 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
  2. 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
  3. New Horizons logo

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

  4. 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.

how safe is LoadSegment

Discussion in 'Age of Pirates Modding' started by kb31, Apr 21, 2017.

  1. kb31

    kb31 Sailor Apprentice Storm Modder

    Joined:
    Jan 13, 2017
    Messages:
    60
    Can I LoadSegment without UnloadSegment? It seems that it unloads automatically during LoadEngineState with warnings in compile.log. Is it safe to use it this way?
     
  2. kb31

    kb31 Sailor Apprentice Storm Modder

    Joined:
    Jan 13, 2017
    Messages:
    60
    Apparently, it's UB... sadly
     
  3. Pieter Boelen

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

    Joined:
    Nov 11, 2004
    Messages:
    65,406
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Those functions are used together in the PotC Reinit functionality.
    Works fine there.
     
    kb31 likes this.
  4. kb31

    kb31 Sailor Apprentice Storm Modder

    Joined:
    Jan 13, 2017
    Messages:
    60
    Together - no doubt
    The question was is it safe to call LoadSegment without corresponding UnloadSegment
    The answer seems to be - no. In some cases game hangs, in others - not.
    This is interested me because I tried to bind LoadSegment to a hotkey in my tehomod. Since it's UB and unsafe I've implemented execution on events so it's ceased to be a problem
     
    Pieter Boelen likes this.

Share This Page