RogerBacon
King
- Joined
- Nov 16, 2003
- Messages
- 649
In player.canTrain()...
BOOL canTrain(INT iUnit, BOOL bContinue, BOOL bTestVisible)
bool (int eUnit, bool bContinue, bool bTestVisible)
I'm assuming that it should return TRUE if I can build the unit.
Well, I have this code:
It is returning true for these units:
PY:unit: Settler
PY:unit: Worker
PY:unit: Fast Worker
PY:unit: Catholic Missionary
PY:unit: Protestant Missionary
PY:unit: Orthodox Missionary
PY:unit: Reformed Missionary
PY:unit: Buddhist Missionary
PY:unit: Confucian Missionary
PY:unit: Taoist Missionary
PY:unit: Warrior
PY:unit: Quechua
PY:unit: Chariot
PY:unit: War Chariot
PY:unit: Immortal
PY:unit: Work Boat
PY:unit: Shinto Missionary
The Missionaries are just the vanilla missionaries with a different name. All of the other units are unchanged. This is turn 2 of a game so I don't have the tech to build the missionaries. Also, I'm not playing the civ to have any of those unique units.
Any idea of what could be wrong? Am I making a wrong assumption about what canTrain() actually does? Also, what are the two BOOLs for in the function?
Roger Bacon
BOOL canTrain(INT iUnit, BOOL bContinue, BOOL bTestVisible)
bool (int eUnit, bool bContinue, bool bTestVisible)
I'm assuming that it should return TRUE if I can build the unit.
Well, I have this code:
Code:
player = gc.getPlayer(pUnit.getOwner())
pPlayer = gc.getPlayer(player.getID())
popup.setHeaderString("Insert title here.")
popup.createPullDown()
for i in range(0 , gc.getNumUnitInfos()):
if (pPlayer.canTrain(i, true, true)):
popup.addPullDownString(" %s" %gc.getUnitInfo(i).getDescription() , i)
message0 = "unit: %s" %gc.getUnitInfo(i).getDescription()
CvUtil.pyPrint(message0)
popup.addButton("Ok")
It is returning true for these units:
PY:unit: Settler
PY:unit: Worker
PY:unit: Fast Worker
PY:unit: Catholic Missionary
PY:unit: Protestant Missionary
PY:unit: Orthodox Missionary
PY:unit: Reformed Missionary
PY:unit: Buddhist Missionary
PY:unit: Confucian Missionary
PY:unit: Taoist Missionary
PY:unit: Warrior
PY:unit: Quechua
PY:unit: Chariot
PY:unit: War Chariot
PY:unit: Immortal
PY:unit: Work Boat
PY:unit: Shinto Missionary
The Missionaries are just the vanilla missionaries with a different name. All of the other units are unchanged. This is turn 2 of a game so I don't have the tech to build the missionaries. Also, I'm not playing the civ to have any of those unique units.
Any idea of what could be wrong? Am I making a wrong assumption about what canTrain() actually does? Also, what are the two BOOLs for in the function?
Roger Bacon