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')
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')
 def NewSystemHousekeeping(self,oldsystem,newsystem):
     print oldsystem,' IS NOW AT ',newsystem
     print oldsystem.split('/')[0]
     if oldsystem.split('/')[0]=='Special':
         print 'Showing splash screen!'
         ShowProgress.activateProgressScreen('loading', 0)
     fg_util.launchBases(newsystem)
     fg_util.launchUnits(newsystem)
     news.newNews()
     newquest = adventure.newAdventure (self.cur_player,oldsystem,newsystem)
     if (newquest):
         self.cur.quests+=[newquest]
     else:
         self.RestoreDroneMission()
     self.CalculateSignificantDistance()
     ShowProgress.deactivateProgressScreen('loading')
     VS.hideSplashScreen()
 def NewSystemHousekeeping(self, oldsystem, newsystem):
     print(oldsystem, ' IS NOW AT ', newsystem)
     print(oldsystem.split('/')[0])
     if oldsystem.split('/')[0] == 'Special':
         print('Showing splash screen!')
         ShowProgress.activateProgressScreen('loading', 0)
     fg_util.launchBases(newsystem)
     fg_util.launchUnits(newsystem)
     news.newNews()
     newquest = adventure.newAdventure(self.cur_player, oldsystem,
                                       newsystem)
     if (newquest):
         self.cur.quests += [newquest]
     else:
         self.RestoreDroneMission()
     self.CalculateSignificantDistance()
     ShowProgress.deactivateProgressScreen('loading')
     VS.hideSplashScreen()
 def Execute(self):
     ShowProgress.deactivateProgressScreen('loading')