ProductionAI problems with productionLocationForEmpire

Problems and solutions for installing or running FreeOrion, including discussion of bugs if needed before posting a bug report on GitHub. For problems building from source, post in Compile.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
RgnadKzin
Space Squid
Posts: 67
Joined: Sun Aug 15, 2010 2:25 am

ProductionAI problems with productionLocationForEmpire

#1 Post by RgnadKzin »

Lately, the productionLocationForEmpire has stopped working.

I am restructuring ProductionAI and am rewriting getAvailableBuildLocations:

Code: Select all

def getAvailableBuildLocations(shipDesignID, empireID, ownedPlanetIDs):
    "returns locations where shipDesign can be built"

    result = []

    shipDesign = fo.getShipDesign(shipDesignID)
    for planetID in ownedPlanetIDs:
	print "    getAvailableBuildLocations(" + str(shipDesignID) + ", " + str(empireID) + ", " + str(planetID) + ")"
        if shipDesign.productionLocationForEmpire(empireID, planetID):
            result.append(planetID)

    return result
shipDesign.productionLocationForEmpire is returning an error:

Code: Select all

2011-02-11 23:07:22,928 DEBUG AI :     shipDesignID: 61-Colony Ship
2011-02-11 23:07:22,928 DEBUG AI :     getAvailableBuildLocations(61, 6, 150)
2011-02-11 23:07:22,928 ERROR AI : Variable<int>::Eval unable to follow reference: Source.Owner
2011-02-11 23:07:22,928 DEBUG AI :     shipDesignID: 63-Mark I
2011-02-11 23:07:22,929 DEBUG AI :     getAvailableBuildLocations(63, 6, 150)
2011-02-11 23:07:22,929 ERROR AI : Variable<int>::Eval unable to follow reference: Source.Owner
2011-02-11 23:07:22,929 DEBUG AI :     shipDesignID: 69-Scout
2011-02-11 23:07:22,929 DEBUG AI :     getAvailableBuildLocations(69, 6, 150)
2011-02-11 23:07:22,929 ERROR AI : Variable<int>::Eval unable to follow reference: Source.Owner
The new ProductionAI.py is attached
Attachments
ProductionAI.py.zip
(1.46 KiB) Downloaded 62 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13603
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: ProductionAI problems with productionLocationForEmpire

#2 Post by Geoff the Medio »

RgnadKzin wrote:Lately, the productionLocationForEmpire has stopped working.
Try the latest SVN... I think I fixed it.

User avatar
RgnadKzin
Space Squid
Posts: 67
Joined: Sun Aug 15, 2010 2:25 am

Re: ProductionAI problems with productionLocationForEmpire

#3 Post by RgnadKzin »

Yes, the AI is building ships again.

Thank you.

Post Reply