def clean(self): global invasionTargets "turn start AIstate cleanup" fleetsLostBySystem.clear() fleetsLostByID.clear() invasionTargets=[] ExplorationAI.graphFlags.clear() print "-------------------------------------------------" print "Border Exploration Update" print "-------------------------------------------------" for sysID in list(self.visBorderSystemIDs): ExplorationAI.followVisSystemConnections(sysID, self.origHomeSystemID) newlyExplored = ExplorationAI.updateExploredSystems() nametags=[] universe = fo.getUniverse() for sysID in newlyExplored: newsys = universe.getSystem(sysID) nametags.append( "ID:%4d -- %20s"%(sysID, (newsys and newsys.name) or"name unknown" ) )# an explored system *should* always be able to be gotten if newlyExplored: print "-------------------------------------------------" print "newly explored systems: \n"+"\n".join(nametags) print "-------------------------------------------------" # cleanup fleet roles #self.updateFleetLocs() self.__cleanFleetRoles() self.__cleanAIFleetMissions(FleetUtilsAI.getEmpireFleetIDs()) print "Fleets lost by system: %s"%fleetsLostBySystem self.updateSystemStatus() ExplorationAI.updateScoutFleets() #should do this after clearing dead fleets, currently should be already done here
def clean(self): "turn start AIstate cleanup" fleetsLostBySystem.clear() fleetsLostByID.clear() invasionTargets[:]=[] exploration_center = PlanetUtilsAI.getCapitalSysID() if exploration_center == -1: #a bad state probably from an old savegame exploration_center = self.origHomeSystemID ExplorationAI.graphFlags.clear() if fo.currentTurn() < 50: print "-------------------------------------------------" print "Border Exploration Update (relative to %s"%(PlanetUtilsAI.sysNameIDs([exploration_center, -1])[0]) print "-------------------------------------------------" if self.visBorderSystemIDs.keys() == [-1]: self.visBorderSystemIDs.clear() self.visBorderSystemIDs[exploration_center] = 1 for sysID in list(self.visBorderSystemIDs): if fo.currentTurn() < 50: print "Considering border system %s"%(PlanetUtilsAI.sysNameIDs([sysID, -1])[0]) ExplorationAI.followVisSystemConnections(sysID, exploration_center) newlyExplored = ExplorationAI.updateExploredSystems() nametags=[] universe = fo.getUniverse() for sysID in newlyExplored: newsys = universe.getSystem(sysID) nametags.append( "ID:%4d -- %20s"%(sysID, (newsys and newsys.name) or"name unknown" ) )# an explored system *should* always be able to be gotten if newlyExplored: print "-------------------------------------------------" print "newly explored systems: \n"+"\n".join(nametags) print "-------------------------------------------------" # cleanup fleet roles #self.updateFleetLocs() self.__cleanFleetRoles() self.__cleanAIFleetMissions(FleetUtilsAI.getEmpireFleetIDs()) print "Fleets lost by system: %s"%fleetsLostBySystem self.updateSystemStatus() ExplorationAI.updateScoutFleets() #should do this after clearing dead fleets, currently should be already done here