suit: Fix too many Cogs on streets

This commit is contained in:
John Cote 2021-06-29 00:46:14 -04:00
parent b65658e8a4
commit 4363eab91c

View file

@ -104,7 +104,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
self.hoodInfoIdx = index self.hoodInfoIdx = index
self.currDesired = None self.currDesired = None
self.baseNumSuits = (self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_MIN] + self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_MAX]) / 2 self.baseNumSuits = (self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_MIN] + self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_MAX]) // 2
self.targetNumCogdos = 0 self.targetNumCogdos = 0
if simbase.air.wantCogdominiums: if simbase.air.wantCogdominiums:
self.targetNumCogdos = int(0.5 + self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_BMIN] * self.CogdoRatio) self.targetNumCogdos = int(0.5 + self.SuitHoodInfo[self.hoodInfoIdx][self.SUIT_HOOD_INFO_BMIN] * self.CogdoRatio)
@ -586,7 +586,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
targetFlyInNum = self.calcDesiredNumFlyInSuits() targetFlyInNum = self.calcDesiredNumFlyInSuits()
targetFlyInNum = min(targetFlyInNum, self.TOTAL_MAX_SUITS - self.numBuildingSuits) targetFlyInNum = min(targetFlyInNum, self.TOTAL_MAX_SUITS - self.numBuildingSuits)
streetPoints = self.streetPointList[:] streetPoints = self.streetPointList[:]
flyInDeficit = (targetFlyInNum - self.numFlyInSuits + 3) / 4 flyInDeficit = (targetFlyInNum - self.numFlyInSuits + 3) // 4
while flyInDeficit > 0: while flyInDeficit > 0:
if not self.createNewSuit([], streetPoints): if not self.createNewSuit([], streetPoints):
break break
@ -602,7 +602,7 @@ class DistributedSuitPlannerAI(DistributedObjectAI.DistributedObjectAI, SuitPlan
targetBuildingNum = int(len(suitBuildings) * self.SUIT_BUILDING_NUM_SUITS) targetBuildingNum = int(len(suitBuildings) * self.SUIT_BUILDING_NUM_SUITS)
targetBuildingNum += flyInDeficit targetBuildingNum += flyInDeficit
targetBuildingNum = min(targetBuildingNum, self.TOTAL_MAX_SUITS - self.numFlyInSuits) targetBuildingNum = min(targetBuildingNum, self.TOTAL_MAX_SUITS - self.numFlyInSuits)
buildingDeficit = (targetBuildingNum - self.numBuildingSuits + 3) / 4 buildingDeficit = (targetBuildingNum - self.numBuildingSuits + 3) // 4
while buildingDeficit > 0: while buildingDeficit > 0:
if not self.createNewSuit(suitBuildings, streetPoints): if not self.createNewSuit(suitBuildings, streetPoints):
break break