def getCanTrainUnits(self, iPlayer, iCheckingPlayer):
pPlayer = gc.getPlayer(iPlayer)
pCheckingPlayer = gc.getPlayer(iCheckingPlayer)
civInfo = gc.getCivilizationInfo(pPlayer.getCivilizationType())
iUnits = set()
for i in range (gc.getNumUnitClassInfos()):
iUnit = civInfo.getCivilizationUnits(i)
pUnitInfo = gc.getUnitInfo(iUnit)
[B]if pUnitInfo.getUnitCombatType() > 0: # ie, not settler, worker, missionary, etc[/B]
for c in range(pPlayer.getNumCities()):
pCity = pPlayer.getCity(c)
if pCity and not pCity.isNone() and pCity.canTrain(iUnit, False, False):
if pUnitInfo.getDomainType() == DomainTypes.DOMAIN_SEA and not pCity.isRevealed(pCheckingPlayer.getTeam(), False):
# Skip water units if the checking player doesn't know about this city
BugUtil.debug("%s can build %s, but %s cannot see the city" % (pCity.getName(), pUnitInfo.getDescription(), pCheckingPlayer.getName()))
continue
iUnits.add(iUnit)
break
return iUnits