def cannotTrain(self,argsList):
pCity = argsList[0]
eUnit = argsList[1]
bContinue = argsList[2]
bTestVisible = argsList[3]
[b]# Begin edit for obsolete units [/b]
# A dictionary for obsolete units.
# The first entry is the unit.
# The second entry is a list of techs that obsolete it.
obsoleteDict = {
"UNIT_WARRIOR": ["TECH_MYSTICISM"],
"UNIT_ARCHER": ["TECH_MYSTICISM", "TECH_MEDITATION"] # No comma for last.
}
# Gets the type of unit we are currently checking
szUnitType = gc.getUnitInfo(eUnit).getType()
# Checks if that unit has techs that make it obsolete
# by seeing if it's name appears in the obsolete dictionary.
if szUnitType in obsoleteList:
# If it does, get the list of techs by giving the dictionary
# the unit name as a key.
obsList = obsoleteDict[szUnitType]
# Go through each technology and determine if
# the player has it.
for szTech in obsList:
# Get the tech number...
eTech = gc.getInfoTypeForString(szTech)
if gc.getTeam(pCity.getTeam()).isHasTech(eTech):
# If the player has that tech, return True
# to say that the unit cannot be built.
return True
# Return False, since the unit is not obsolete, and thus can be
# built.
[b]# End edit for obsolete units [/b]
return False
}