def doReInit(self):
iPlayer = PyPlayer(CyGame().getActivePlayer())
unitList = iPlayer.getUnitList()
# Loop for all players cities
for ii in range(len(unitList)):
pLoopUnit = unitList[ii]
# get the group the unit belongs to.
pGroup = pLoopUnit.getGroup()
# check if unit is doing air patrol
if (pGroup.getActivityType() == ActivityTypes.ACTIVITY_INTERCEPT):
# remove mission (this one shold be obsolete, but who knows ;)
pGroup.popMission()
pPlot = pGroup.plot()
# add new mission -> fortify
pGroup.pushMission(MissionTypes.MISSION_FORTIFY, 0, 0, 0, false, false, MissionAITypes.NO_MISSIONAI, pPlot, pLoopUnit)
# add new mission -> air patrol
pGroup.pushMission(MissionTypes.MISSION_AIRPATROL, 0, 0, 0, false, false, MissionAITypes.NO_MISSIONAI, pPlot, pLoopUnit)