golf: fix golf kart AI crashes
This commit is contained in:
parent
59bbb8d9c7
commit
efc2147ad0
2 changed files with 4 additions and 4 deletions
|
@ -33,7 +33,6 @@ class __GolfManagerAI(DirectObject.DirectObject):
|
|||
newCourse = DistributedGolfCourseAI.DistributedGolfCourseAI(golfZone, avIds, courseId, preferredHoleId)
|
||||
newCourse.generateWithRequired(golfZone)
|
||||
self.courseList.append(newCourse)
|
||||
newCourse.addExpectedGolfers(avIds)
|
||||
golfZone = newCourse.getZoneId()
|
||||
self.notify.debug('%s' % self)
|
||||
self.notify.debug('returning %d' % golfZone)
|
||||
|
|
|
@ -146,7 +146,7 @@ class DistributedGolfKartAI(DistributedObjectAI.DistributedObjectAI):
|
|||
|
||||
def clearFullNow(self, seatIndex):
|
||||
avId = self.seats[seatIndex]
|
||||
if avId == 0:
|
||||
if not avId:
|
||||
self.notify.warning('Clearing an empty seat index: ' + str(seatIndex) + ' ... Strange...')
|
||||
else:
|
||||
self.seats[seatIndex] = None
|
||||
|
@ -291,8 +291,9 @@ class DistributedGolfKartAI(DistributedObjectAI.DistributedObjectAI):
|
|||
if numPlayers > 0:
|
||||
for seatIndex in range(len(self.seats)):
|
||||
avId = self.seats[seatIndex]
|
||||
avIdList.append(avId)
|
||||
self.clearFullNow(seatIndex)
|
||||
if avId:
|
||||
avIdList.append(avId)
|
||||
self.clearFullNow(seatIndex)
|
||||
|
||||
golfZone = GolfManagerAI.GolfManagerAI().readyGolfCourse(avIdList, self.golfCourse)
|
||||
for avId in avIdList:
|
||||
|
|
Loading…
Reference in a new issue