Geoff the Medio wrote:
It would be better to keep a set or list of all systems to which fleets have been sent.
That sounds reasonable. However, there is one thing that troubles me: what if a fleet is given an exploration order - this is recorded in a list (let's say, systems_being_explored) - and then is destroyed before it can finish its mission? Since the AI still believes a fleet is en route, it would never again send a fleet to explore the system. To avoid this, if a fleet is destroyed that was sent to explore a system, its destination must be removed from the list.
Also, on exploration systems should be removed from systems_being_explored, so that the list really only holds systems that are being explored, and not also systems that have been explored; so that if a system, for some reason whatsoever (event, veiling tech, ...), becomes unexplored again, the AI will send ships.
systems_being_explored should be a field of every AI client and initialized with the AI constructor.
# get stationary fleets
fleetIDs = getEmpireStationaryFleetIDs(empireID)
print "fleetIDs: " + str(fleetIDs)
# order stationary fleets to explore
for fleet_id in fleetIDs:
fleet = universe.getFleet(fleet_id)
if (fleet == None): continue
startSystemID = fleet.systemID
if (startSystemID == universe.invalidObjectID): continue
systemIDs = getExplorableSystemIDs(startSystemID, empireID)
# iterate through systemIDs and remove systems that are being explored
for ID in systemIDs:
if (ID in systems_being_explored):
if (len(systemIDs) > 0):
destinationID = systemIDs # could be removed