コード例 #1
0
def ReloadUniverse():
    global genUniverse, hasUniverse
    if cp >= 0:
        ShowProgress.activateProgressScreen("loading", force=True)
        debug.debug('Purging...')
        for i in fg_util.AllFactions():
            fg_util.PurgeZeroShips(i)
            systemcount[i] = 0
        debug.debug('StartSystemCount')
        ForEachSys(CountSystems)
        debug.debug(systemcount)
        debug.debug('EndSystemCount')
        genUniverse = 0
        needNewUniverse = 0
        curfaclist = fg_util.AllFactions()
        reflist = fg_util.ReadStringList(cp, "FactionRefList")

        if (reflist != curfaclist):
            needNewUniverse = 1
            debug.debug('reflist is ' + str(reflist))
            debug.debug('curfaclist is ' + str(curfaclist))

        if (fg_util.HasLegacyFGFormat()):
            needNewUniverse = 1
            debug.warn(
                'save using legacy FG format... resetting universe to reformat'
            )
            fg_util.DeleteLegacyFGLeftovers()

        if needNewUniverse:
            fg_util.WriteStringList(cp, "FactionRefList", curfaclist)
            debug.debug('generating ships... ... ...')
            GenerateAllShips(
            )  ###Insert number of flight groups and max ships per fg
            debug.debug('placing ships... ... ...')
            genUniverse = MakeUniverse()
            #now every system has distributed ships in the save data!
        else:
            GenerateAllShips()
            debug.debug("Second Load")
            for i in range(len(fgnames)):
                fg_util.origfgoffset = fgoffset[i]
                fgnames[i] = fg_util.TweakFGNames(origfgnames[i])
                fgoffset[i] += 1
        campaigns.loadAll(cp)
        hasUniverse = True
        #TODO: add ships to current system (for both modes)  uru?
        ShowProgress.deactivateProgressScreen('loading')
    else:
        debug.error('fatal error: no cockpit')
コード例 #2
0
def ReloadUniverse():
  global genUniverse, hasUniverse
  if cp>=0:
    ShowProgress.activateProgressScreen("loading",force=True)
    debug.debug('Purging...')
    for i in fg_util.AllFactions():
        fg_util.PurgeZeroShips(i)
        systemcount[i]=0
    debug.debug('StartSystemCount')
    ForEachSys(CountSystems)
    debug.debug(systemcount)
    debug.debug('EndSystemCount')
    genUniverse=0
    needNewUniverse=0
    curfaclist = fg_util.AllFactions()
    reflist = fg_util.ReadStringList(cp,"FactionRefList")
    
    if (reflist !=curfaclist):
        needNewUniverse = 1
        debug.debug('reflist is '+str(reflist))
        debug.debug('curfaclist is '+str(curfaclist))

    if (fg_util.HasLegacyFGFormat()):
        needNewUniverse = 1
        debug.warn('save using legacy FG format... resetting universe to reformat')
        fg_util.DeleteLegacyFGLeftovers()

    if needNewUniverse:
        fg_util.WriteStringList(cp,"FactionRefList",curfaclist)
        debug.debug('generating ships... ... ...')
        GenerateAllShips() ###Insert number of flight groups and max ships per fg
        debug.debug('placing ships... ... ...')
        genUniverse=MakeUniverse()
        #now every system has distributed ships in the save data!
    else:
        GenerateAllShips()
        debug.debug("Second Load")
        for i in xrange(len(fgnames)):
            fg_util.origfgoffset=fgoffset[i]
            fgnames[i]=fg_util.TweakFGNames(origfgnames[i])
            fgoffset[i]+=1
    campaigns.loadAll(cp)
    hasUniverse=True;
    #TODO: add ships to current system (for both modes)  uru?
    ShowProgress.deactivateProgressScreen('loading')
  else:
    debug.error('fatal error: no cockpit')
コード例 #3
0
ファイル: verify.py プロジェクト: npetrell/privateer_wcu
from campaign_lib import *
import debug
import campaigns
import verify_missions


campaigns.loadAll(0)
global traverser
traverser=[]

def isType(a,typ):
    return a.__init__.im_func==typ.__init__.im_func

exnonescript=None

class MyCondition:
    def __init__(self,var=[]):
        self.system=("","")
        self.vars=var
    def pre(self,precond):
        #FIXME
        return True
    def script(self,scriptname,trav):
        if (scriptname==None and not isType(trav.node,CampaignChoiceNode)):
            trav.warn("None script")
            return False
        return isinstance(scriptname,TrueSubnode)
    def post(self,postcond):
        #FIXME
        return True
コード例 #4
0
    sys=VS.getSystemFile()
    if (VS.GetGalaxyProperty("Sol/Sol","jumps")!="" and VS.GetGalaxyProperty("Sol/Sol","faction")!=""):
        debug.debug("He's got SOL")
        sys="Sol/Sol"
    ForEachSys(sys,CountSystems)
    debug.debug(systemcount)
    debug.debug('EndSystemCount')
    genUniverse=0
    curfaclist = fg_util.AllFactions()
    reflist = fg_util.ReadStringList(cp,"FactionRefList")
    if (reflist !=curfaclist):
        debug.debug('reflist is '+str(reflist))
        debug.debug('curfaclist is '+str(curfaclist))

        fg_util.WriteStringList(cp,"FactionRefList",curfaclist)
        debug.debug('generating ships... ... ...')
        GenerateAllShips () ###Insert number of flight groups and max ships per fg
        debug.debug('placing ships... ... ...')
        genUniverse=Makesys(sys)
        #now every system has distributed ships in the save data!
    else:
        GenerateAllShips()
        debug.debug("Second Load")
        for i in range(len(fgnames)):
            fgnames[i]=fg_util.TweakFGNames(origfgnames[i])
        fg_util.origfgoffset+=1
    campaigns.loadAll(cp)
    #TODO: add ships to current system (for both modes)  uru?
else:
    debug.error('fatal error: no cockpit')
コード例 #5
0
            and VS.GetGalaxyProperty("Sol/Sol", "faction") != ""):
        debug.debug("He's got SOL")
        sys = "Sol/Sol"
    ForEachSys(sys, CountSystems)
    debug.debug(systemcount)
    debug.debug('EndSystemCount')
    genUniverse = 0
    curfaclist = fg_util.AllFactions()
    reflist = fg_util.ReadStringList(cp, "FactionRefList")
    if (reflist != curfaclist):
        debug.debug('reflist is ' + str(reflist))
        debug.debug('curfaclist is ' + str(curfaclist))

        fg_util.WriteStringList(cp, "FactionRefList", curfaclist)
        debug.debug('generating ships... ... ...')
        GenerateAllShips(
        )  ###Insert number of flight groups and max ships per fg
        debug.debug('placing ships... ... ...')
        genUniverse = Makesys(sys)
        #now every system has distributed ships in the save data!
    else:
        GenerateAllShips()
        debug.debug("Second Load")
        for i in range(len(fgnames)):
            fgnames[i] = fg_util.TweakFGNames(origfgnames[i])
        fg_util.origfgoffset += 1
    campaigns.loadAll(cp)
    #TODO: add ships to current system (for both modes)  uru?
else:
    debug.error('fatal error: no cockpit')