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 = DistributedGolfCourseAI.DistributedGolfCourseAI(golfZone, avIds, courseId, preferredHoleId)
|
||||||
newCourse.generateWithRequired(golfZone)
|
newCourse.generateWithRequired(golfZone)
|
||||||
self.courseList.append(newCourse)
|
self.courseList.append(newCourse)
|
||||||
newCourse.addExpectedGolfers(avIds)
|
|
||||||
golfZone = newCourse.getZoneId()
|
golfZone = newCourse.getZoneId()
|
||||||
self.notify.debug('%s' % self)
|
self.notify.debug('%s' % self)
|
||||||
self.notify.debug('returning %d' % golfZone)
|
self.notify.debug('returning %d' % golfZone)
|
||||||
|
|
|
@ -146,7 +146,7 @@ class DistributedGolfKartAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
|
|
||||||
def clearFullNow(self, seatIndex):
|
def clearFullNow(self, seatIndex):
|
||||||
avId = self.seats[seatIndex]
|
avId = self.seats[seatIndex]
|
||||||
if avId == 0:
|
if not avId:
|
||||||
self.notify.warning('Clearing an empty seat index: ' + str(seatIndex) + ' ... Strange...')
|
self.notify.warning('Clearing an empty seat index: ' + str(seatIndex) + ' ... Strange...')
|
||||||
else:
|
else:
|
||||||
self.seats[seatIndex] = None
|
self.seats[seatIndex] = None
|
||||||
|
@ -291,6 +291,7 @@ class DistributedGolfKartAI(DistributedObjectAI.DistributedObjectAI):
|
||||||
if numPlayers > 0:
|
if numPlayers > 0:
|
||||||
for seatIndex in range(len(self.seats)):
|
for seatIndex in range(len(self.seats)):
|
||||||
avId = self.seats[seatIndex]
|
avId = self.seats[seatIndex]
|
||||||
|
if avId:
|
||||||
avIdList.append(avId)
|
avIdList.append(avId)
|
||||||
self.clearFullNow(seatIndex)
|
self.clearFullNow(seatIndex)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue