mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
Convert range to xrange
This commit is contained in:
parent
f3c82a3c4a
commit
468b1702d8
47 changed files with 166 additions and 166 deletions
|
@ -243,7 +243,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
self.hashVal = dcFile.getHash()
|
||||
|
||||
# Now import all of the modules required by the DC file.
|
||||
for n in range(dcFile.getNumImportModules()):
|
||||
for n in xrange(dcFile.getNumImportModules()):
|
||||
moduleName = dcFile.getImportModule(n)[:]
|
||||
|
||||
# Maybe the module name is represented as "moduleName/AI".
|
||||
|
@ -256,7 +256,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
moduleName += 'AI'
|
||||
|
||||
importSymbols = []
|
||||
for i in range(dcFile.getNumImportSymbols(n)):
|
||||
for i in xrange(dcFile.getNumImportSymbols(n)):
|
||||
symbolName = dcFile.getImportSymbol(n, i)
|
||||
|
||||
# Maybe the symbol name is represented as "symbolName/AI".
|
||||
|
@ -274,7 +274,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
|
||||
# Now get the class definition for the classes named in the DC
|
||||
# file.
|
||||
for i in range(dcFile.getNumClasses()):
|
||||
for i in xrange(dcFile.getNumClasses()):
|
||||
dclass = dcFile.getClass(i)
|
||||
number = dclass.getNumber()
|
||||
className = dclass.getName() + self.dcSuffix
|
||||
|
@ -315,7 +315,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
ownerImportSymbols = {}
|
||||
|
||||
# Now import all of the modules required by the DC file.
|
||||
for n in range(dcFile.getNumImportModules()):
|
||||
for n in xrange(dcFile.getNumImportModules()):
|
||||
moduleName = dcFile.getImportModule(n)
|
||||
|
||||
# Maybe the module name is represented as "moduleName/AI".
|
||||
|
@ -326,7 +326,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
moduleName = moduleName + ownerDcSuffix
|
||||
|
||||
importSymbols = []
|
||||
for i in range(dcFile.getNumImportSymbols(n)):
|
||||
for i in xrange(dcFile.getNumImportSymbols(n)):
|
||||
symbolName = dcFile.getImportSymbol(n, i)
|
||||
|
||||
# Check for the OV suffix
|
||||
|
@ -342,7 +342,7 @@ class OTPClientRepository(ClientRepositoryBase):
|
|||
|
||||
# Now get the class definition for the owner classes named
|
||||
# in the DC file.
|
||||
for i in range(dcFile.getNumClasses()):
|
||||
for i in xrange(dcFile.getNumClasses()):
|
||||
dclass = dcFile.getClass(i)
|
||||
if ((dclass.getName()+ownerDcSuffix) in ownerImportSymbols):
|
||||
number = dclass.getNumber()
|
||||
|
|
|
@ -332,7 +332,7 @@ class DistributedBuildingAI(DistributedObjectAI.DistributedObjectAI):
|
|||
continue
|
||||
|
||||
victorList.extend([None, None, None, None])
|
||||
for i in range(0, 4):
|
||||
for i in xrange(0, 4):
|
||||
victor = victorList[i]
|
||||
if victor == None or not self.air.doId2do.has_key(victor):
|
||||
victorList[i] = 0
|
||||
|
|
|
@ -347,7 +347,7 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
|
|||
if dna.topTex == defn[0] and dna.topTexColor == defn[2][self.colorIndex][0] and dna.sleeveTex == defn[1] and dna.sleeveTexColor == defn[2][self.colorIndex][1]:
|
||||
return 1
|
||||
l = avatar.clothesTopsList
|
||||
for i in range(0, len(l), 4):
|
||||
for i in xrange(0, len(l), 4):
|
||||
if l[i] == defn[0] and l[i + 1] == defn[2][self.colorIndex][0] and l[i + 2] == defn[1] and l[i + 3] == defn[2][self.colorIndex][1]:
|
||||
return 1
|
||||
|
||||
|
@ -356,7 +356,7 @@ class CatalogClothingItem(CatalogItem.CatalogItem):
|
|||
if dna.botTex == defn[0] and dna.botTexColor == defn[1][self.colorIndex]:
|
||||
return 1
|
||||
l = avatar.clothesBottomsList
|
||||
for i in range(0, len(l), 2):
|
||||
for i in xrange(0, len(l), 2):
|
||||
if l[i] == defn[0] and l[i + 1] == defn[1][self.colorIndex]:
|
||||
return 1
|
||||
|
||||
|
@ -577,7 +577,7 @@ def getAllClothes(*clothingTypes):
|
|||
for clothingType in clothingTypes:
|
||||
base = CatalogClothingItem(clothingType, 0)
|
||||
list.append(base)
|
||||
for n in range(1, len(base.getColorChoices())):
|
||||
for n in xrange(1, len(base.getColorChoices())):
|
||||
list.append(CatalogClothingItem(clothingType, n))
|
||||
|
||||
return list
|
||||
|
|
|
@ -136,7 +136,7 @@ def getAllFloorings(*indexList):
|
|||
for index in indexList:
|
||||
colors = FlooringTypes[index][FTColor]
|
||||
if colors:
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogFlooringItem(index, n))
|
||||
|
||||
else:
|
||||
|
@ -160,7 +160,7 @@ def getFlooringRange(fromIndex, toIndex, *otherRanges):
|
|||
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
||||
colors = FlooringTypes[patternIndex][FTColor]
|
||||
if colors:
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogFlooringItem(patternIndex, n))
|
||||
|
||||
else:
|
||||
|
|
|
@ -1215,7 +1215,7 @@ def getMaxTrunks():
|
|||
def getAllFurnitures(index):
|
||||
list = []
|
||||
colors = FurnitureTypes[index][FTColorOptions]
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogFurnitureItem(index, n))
|
||||
|
||||
return list
|
||||
|
|
|
@ -1538,7 +1538,7 @@ class CatalogGenerator:
|
|||
lastBackCatalog = avatar.backCatalog[:]
|
||||
thisWeek = min(len(WeeklySchedule), week - 1)
|
||||
lastWeek = min(len(WeeklySchedule), previousWeek)
|
||||
for week in range(thisWeek, lastWeek, -1):
|
||||
for week in xrange(thisWeek, lastWeek, -1):
|
||||
self.notify.debug('Adding items from week %s to back catalog' % week)
|
||||
schedule = WeeklySchedule[week - 1]
|
||||
if not isinstance(schedule, Sale):
|
||||
|
@ -1603,7 +1603,7 @@ class CatalogGenerator:
|
|||
selection.append(item)
|
||||
elif item != None:
|
||||
list = item[:]
|
||||
for i in range(chooseCount):
|
||||
for i in xrange(chooseCount):
|
||||
if len(list) == 0:
|
||||
return selection
|
||||
item = self.__chooseFromList(avatar, list, duplicateItems)
|
||||
|
@ -1679,7 +1679,7 @@ class CatalogGenerator:
|
|||
|
||||
def generateScheduleDictionary(self):
|
||||
sched = {}
|
||||
for index in range(len(WeeklySchedule)):
|
||||
for index in xrange(len(WeeklySchedule)):
|
||||
week = index + 1
|
||||
schedule = WeeklySchedule[index]
|
||||
if isinstance(schedule, Sale):
|
||||
|
|
|
@ -319,13 +319,13 @@ class CatalogItem:
|
|||
tex = loader.loadTexture(color)
|
||||
tex.setMinfilter(Texture.FTLinearMipmapLinear)
|
||||
tex.setMagfilter(Texture.FTLinear)
|
||||
for i in range(matches.getNumPaths()):
|
||||
for i in xrange(matches.getNumPaths()):
|
||||
matches.getPath(i).setTexture(tex, 1)
|
||||
|
||||
else:
|
||||
needsAlpha = color[3] != 1
|
||||
color = VBase4(color[0], color[1], color[2], color[3])
|
||||
for i in range(matches.getNumPaths()):
|
||||
for i in xrange(matches.getNumPaths()):
|
||||
matches.getPath(i).setColorScale(color, 1)
|
||||
if needsAlpha:
|
||||
matches.getPath(i).setTransparency(1)
|
||||
|
|
|
@ -116,7 +116,7 @@ def getAllMouldings(*indexList):
|
|||
for index in indexList:
|
||||
colors = MouldingTypes[index][MTColor]
|
||||
if colors:
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogMouldingItem(index, n))
|
||||
|
||||
else:
|
||||
|
@ -140,7 +140,7 @@ def getMouldingRange(fromIndex, toIndex, *otherRanges):
|
|||
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
||||
colors = MouldingTypes[patternIndex][MTColor]
|
||||
if colors:
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogMouldingItem(patternIndex, n))
|
||||
|
||||
else:
|
||||
|
|
|
@ -106,7 +106,7 @@ def nextAvailablePole(avatar, duplicateItems):
|
|||
|
||||
def getAllPoles():
|
||||
list = []
|
||||
for rodId in range(0, FishGlobals.MaxRodId + 1):
|
||||
for rodId in xrange(0, FishGlobals.MaxRodId + 1):
|
||||
list.append(CatalogPoleItem(rodId))
|
||||
|
||||
return list
|
||||
|
|
|
@ -305,8 +305,8 @@ class CatalogScreen(DirectFrame):
|
|||
pIndex = 0
|
||||
randGen = random.Random()
|
||||
randGen.seed(base.localAvatar.catalogScheduleCurrentWeek + (self.pageIndex << 8) + (newOrBackOrSpecial << 16))
|
||||
for i in range(NUM_CATALOG_ROWS):
|
||||
for j in range(NUM_CATALOG_COLS):
|
||||
for i in xrange(NUM_CATALOG_ROWS):
|
||||
for j in xrange(NUM_CATALOG_COLS):
|
||||
if pIndex < len(self.visiblePanels):
|
||||
type = self.visiblePanels[pIndex]['item'].getTypeCode()
|
||||
self.squares[i][j].setColor(CatalogPanelColors.values()[randGen.randint(0, len(CatalogPanelColors) - 1)])
|
||||
|
@ -573,7 +573,7 @@ class CatalogScreen(DirectFrame):
|
|||
self.__chooseFriend(self.ffList[0][0], self.ffList[0][1])
|
||||
self.update()
|
||||
self.createdGiftGui = 1
|
||||
for i in range(4):
|
||||
for i in xrange(4):
|
||||
self.newCatalogButton.component('text%d' % i).setR(90)
|
||||
self.newCatalogButton2.component('text%d' % i).setR(90)
|
||||
self.backCatalogButton.component('text%d' % i).setR(90)
|
||||
|
@ -587,8 +587,8 @@ class CatalogScreen(DirectFrame):
|
|||
[],
|
||||
[],
|
||||
[]]
|
||||
for i in range(NUM_CATALOG_ROWS):
|
||||
for j in range(NUM_CATALOG_COLS):
|
||||
for i in xrange(NUM_CATALOG_ROWS):
|
||||
for j in xrange(NUM_CATALOG_COLS):
|
||||
square = guiItems.find('**/square%d%db' % (i + 1, j + 1))
|
||||
label = DirectLabel(self.base, image=square, relief=None, state='normal')
|
||||
self.squares[i].append(label)
|
||||
|
|
|
@ -50,7 +50,7 @@ class CatalogToonStatueItem(CatalogGardenItem.CatalogGardenItem):
|
|||
|
||||
def getAllToonStatues(self):
|
||||
self.statueList = []
|
||||
for index in range(self.startPoseIndex, self.endPoseIndex + 1):
|
||||
for index in xrange(self.startPoseIndex, self.endPoseIndex + 1):
|
||||
self.statueList.append(CatalogToonStatueItem(index, 1, endPoseIndex=index))
|
||||
|
||||
return self.statueList
|
||||
|
|
|
@ -107,7 +107,7 @@ def getAllWainscotings(*indexList):
|
|||
for index in indexList:
|
||||
colors = WainscotingTypes[index][WSTColor]
|
||||
if colors:
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogWainscotingItem(index, n))
|
||||
|
||||
else:
|
||||
|
@ -131,7 +131,7 @@ def getWainscotingRange(fromIndex, toIndex, *otherRanges):
|
|||
if patternIndex >= fromIndex and patternIndex <= toIndex:
|
||||
colors = WainscotingTypes[patternIndex][WSTColor]
|
||||
if colors:
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogWainscotingItem(patternIndex, n))
|
||||
|
||||
else:
|
||||
|
|
|
@ -704,9 +704,9 @@ def getAllWallpapers(*typeList):
|
|||
numBorderColors = len(borderData[BDColor])
|
||||
else:
|
||||
numBorderColors = 1
|
||||
for borderColorIndex in range(numBorderColors):
|
||||
for borderColorIndex in xrange(numBorderColors):
|
||||
colors = WallpaperTypes[index][WTColor]
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogWallpaperItem(index, n, borderKey, borderColorIndex))
|
||||
|
||||
return list
|
||||
|
@ -732,9 +732,9 @@ def getWallpaperRange(fromIndex, toIndex, *otherRanges):
|
|||
numBorderColors = len(borderData[BDColor])
|
||||
else:
|
||||
numBorderColors = 1
|
||||
for borderColorIndex in range(numBorderColors):
|
||||
for borderColorIndex in xrange(numBorderColors):
|
||||
colors = WallpaperTypes[patternIndex][WTColor]
|
||||
for n in range(len(colors)):
|
||||
for n in xrange(len(colors)):
|
||||
list.append(CatalogWallpaperItem(patternIndex, n, borderKey, borderColorIndex))
|
||||
|
||||
return list
|
||||
|
|
|
@ -48,7 +48,7 @@ class CogdoBarrelRoom:
|
|||
self.fog.setColor(CogdoBarrelRoomConsts.BarrelRoomFogColor)
|
||||
self.fog.setLinearRange(*CogdoBarrelRoomConsts.BarrelRoomFogLinearRange)
|
||||
self.brBarrel = render.attachNewNode('@@CogdoBarrels')
|
||||
for i in range(len(CogdoBarrelRoomConsts.BarrelProps)):
|
||||
for i in xrange(len(CogdoBarrelRoomConsts.BarrelProps)):
|
||||
self.bPath = self.brBarrel.attachNewNode('%s%s'% (CogdoBarrelRoomConsts.BarrelPathName, i))
|
||||
self.bPath.setPos(CogdoBarrelRoomConsts.BarrelProps[i]['pos'])
|
||||
self.bPath.setH(CogdoBarrelRoomConsts.BarrelProps[i]['heading'])
|
||||
|
@ -109,11 +109,11 @@ class CogdoBarrelRoom:
|
|||
self.timer.stash()
|
||||
|
||||
def placeToonsAtEntrance(self, toons):
|
||||
for i in range(len(toons)):
|
||||
for i in xrange(len(toons)):
|
||||
toons[i].setPosHpr(self.entranceNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i])
|
||||
|
||||
def placeToonsNearBattle(self, toons):
|
||||
for i in range(len(toons)):
|
||||
for i in xrange(len(toons)):
|
||||
toons[i].setPosHpr(self.nearBattleNode, *CogdoBarrelRoomConsts.BarrelRoomPlayerSpawnPoints[i])
|
||||
|
||||
def showBattleAreaLight(self, visible = True):
|
||||
|
|
|
@ -147,13 +147,13 @@ class CogdoFlyingFuelGui(DirectFrame):
|
|||
return
|
||||
numBlades = fuelState - 1
|
||||
if len(self.activeBlades) != numBlades:
|
||||
for i in range(len(self.activeBlades)):
|
||||
for i in xrange(len(self.activeBlades)):
|
||||
blade = self.activeBlades.pop()
|
||||
blade.stash()
|
||||
|
||||
if numBlades > len(self.blades):
|
||||
numBlades = len(self.blades)
|
||||
for i in range(numBlades):
|
||||
for i in xrange(numBlades):
|
||||
blade = self.blades[i]
|
||||
self.activeBlades.append(blade)
|
||||
blade.unstash()
|
||||
|
|
|
@ -168,7 +168,7 @@ class CogdoFlyingLevel(DirectObject):
|
|||
self.endPlatform.onstage()
|
||||
|
||||
self._currentQuadNum = quadNum
|
||||
for i in range(0, max(self._currentQuadNum - self.quadVisibiltyBehind, 0)) + range(min(self._currentQuadNum + self.quadVisibiltyAhead + 1, self._numQuads), self._numQuads):
|
||||
for i in xrange(0, max(self._currentQuadNum - self.quadVisibiltyBehind, 0)) + range(min(self._currentQuadNum + self.quadVisibiltyAhead + 1, self._numQuads), self._numQuads):
|
||||
self.quadrants[i].offstage()
|
||||
if i == 0:
|
||||
self.startPlatform.offstage()
|
||||
|
|
|
@ -233,14 +233,14 @@ class CogdoFlyingPlayer(FSM):
|
|||
return
|
||||
numBlades = fuelState - 1
|
||||
if len(self.activeBlades) != numBlades:
|
||||
for i in range(len(self.activeBlades)):
|
||||
for i in xrange(len(self.activeBlades)):
|
||||
blade = self.activeBlades.pop()
|
||||
blade.stash()
|
||||
|
||||
if numBlades > len(self.blades):
|
||||
numBlades = len(self.blades)
|
||||
if numBlades > 0:
|
||||
for i in range(numBlades):
|
||||
for i in xrange(numBlades):
|
||||
blade = self.blades[i]
|
||||
self.activeBlades.append(blade)
|
||||
blade.unstash()
|
||||
|
|
|
@ -68,7 +68,7 @@ class CogdoInterior(Place.Place):
|
|||
self.parentFSM.getStateNamed('cogdoInterior').addChild(self.fsm)
|
||||
self.townBattle = TownBattle.TownBattle('town-battle-done')
|
||||
self.townBattle.load()
|
||||
for i in range(1, 3):
|
||||
for i in xrange(1, 3):
|
||||
Suit.loadSuits(i)
|
||||
|
||||
def unload(self):
|
||||
|
@ -82,7 +82,7 @@ class CogdoInterior(Place.Place):
|
|||
self.townBattle.unload()
|
||||
self.townBattle.cleanup()
|
||||
del self.townBattle
|
||||
for i in range(1, 3):
|
||||
for i in xrange(1, 3):
|
||||
Suit.unloadSuits(i)
|
||||
|
||||
def setState(self, state, battleEvent = None):
|
||||
|
|
|
@ -103,8 +103,8 @@ class CogdoMazeFactory:
|
|||
quadrantKeys = self._cogdoMazeData.QuadrantCollisions.keys()
|
||||
self._rng.shuffle(quadrantKeys)
|
||||
i = 0
|
||||
for y in range(self.height):
|
||||
for x in range(self.width):
|
||||
for y in xrange(self.height):
|
||||
for x in xrange(self.width):
|
||||
key = quadrantKeys[i]
|
||||
collTable = self._cogdoMazeData.QuadrantCollisions[key]
|
||||
angle = self._cogdoMazeData.QuadrantAngles[self._rng.randint(0, len(self._cogdoMazeData.QuadrantAngles) - 1)]
|
||||
|
@ -115,9 +115,9 @@ class CogdoMazeFactory:
|
|||
|
||||
def _generateBarrierData(self):
|
||||
data = []
|
||||
for y in range(self.height):
|
||||
for y in xrange(self.height):
|
||||
data.append([])
|
||||
for x in range(self.width):
|
||||
for x in xrange(self.width):
|
||||
if x == self.width - 1:
|
||||
ax = -1
|
||||
else:
|
||||
|
@ -198,12 +198,12 @@ class CogdoMazeFactory:
|
|||
self._data['originX'] = int(self._data['width'] / 2)
|
||||
self._data['originY'] = int(self._data['height'] / 2)
|
||||
collisionTable = []
|
||||
horizontalWall = [ 1 for x in range(self._data['width']) ]
|
||||
horizontalWall = [ 1 for x in xrange(self._data['width']) ]
|
||||
collisionTable.append(horizontalWall)
|
||||
for i in range(0, len(self.quadrantData), self.width):
|
||||
for y in range(self.quadrantSize):
|
||||
for i in xrange(0, len(self.quadrantData), self.width):
|
||||
for y in xrange(self.quadrantSize):
|
||||
row = [1]
|
||||
for x in range(i, i + self.width):
|
||||
for x in xrange(i, i + self.width):
|
||||
if x == 1 and y < self.quadrantSize / 2 - 2:
|
||||
newData = []
|
||||
for j in self.quadrantData[x][1][y]:
|
||||
|
@ -221,17 +221,17 @@ class CogdoMazeFactory:
|
|||
collisionTable.append(horizontalWall[:])
|
||||
|
||||
barriers = Globals.MazeBarriers
|
||||
for i in range(len(barriers)):
|
||||
for i in xrange(len(barriers)):
|
||||
for coords in barriers[i]:
|
||||
collisionTable[coords[1]][coords[0]] = 0
|
||||
|
||||
y = self._data['originY']
|
||||
for x in range(len(collisionTable[y])):
|
||||
for x in xrange(len(collisionTable[y])):
|
||||
if collisionTable[y][x] == 0:
|
||||
collisionTable[y][x] = 2
|
||||
|
||||
x = self._data['originX']
|
||||
for y in range(len(collisionTable)):
|
||||
for y in xrange(len(collisionTable)):
|
||||
if collisionTable[y][x] == 0:
|
||||
collisionTable[y][x] = 2
|
||||
|
||||
|
@ -248,8 +248,8 @@ class CogdoMazeFactory:
|
|||
halfWidth = int(self.width / 2)
|
||||
halfHeight = int(self.height / 2)
|
||||
i = 0
|
||||
for y in range(self.height):
|
||||
for x in range(self.width):
|
||||
for y in xrange(self.height):
|
||||
for x in xrange(self.width):
|
||||
ax = (x - halfWidth) * size
|
||||
ay = (y - halfHeight) * size
|
||||
extension = ''
|
||||
|
@ -266,7 +266,7 @@ class CogdoMazeFactory:
|
|||
quadrantHalfUnitSize = quadrantUnitSize * 0.5
|
||||
barrierModel = CogdoUtil.loadMazeModel('grouping_blockerDivider').find('**/divider')
|
||||
y = 3
|
||||
for x in range(self.width):
|
||||
for x in xrange(self.width):
|
||||
if x == (self.width - 1) / 2:
|
||||
continue
|
||||
ax = (x - halfWidth) * size
|
||||
|
@ -278,7 +278,7 @@ class CogdoMazeFactory:
|
|||
|
||||
offset = self.cellWidth - 0.5
|
||||
for x in (0, 3):
|
||||
for y in range(self.height):
|
||||
for y in xrange(self.height):
|
||||
ax = (x - halfWidth) * size - quadrantHalfUnitSize - frameActualSize + offset
|
||||
ay = (y - halfHeight) * size
|
||||
b = NodePath('barrier')
|
||||
|
|
|
@ -50,20 +50,20 @@ class CogdoMazeGame(DirectObject):
|
|||
self.lastBalloonTimestamp = None
|
||||
difficulty = self.distGame.getDifficulty()
|
||||
serialNum = 0
|
||||
for i in range(numSuits[0]):
|
||||
for i in xrange(numSuits[0]):
|
||||
suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
|
||||
suit = CogdoMazeBossSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[0][i])
|
||||
self.addSuit(suit)
|
||||
self.guiMgr.mazeMapGui.addSuit(suit.suit)
|
||||
serialNum += 1
|
||||
|
||||
for i in range(numSuits[1]):
|
||||
for i in xrange(numSuits[1]):
|
||||
suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
|
||||
suit = CogdoMazeFastMinionSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[1][i])
|
||||
self.addSuit(suit)
|
||||
serialNum += 1
|
||||
|
||||
for i in range(numSuits[2]):
|
||||
for i in xrange(numSuits[2]):
|
||||
suitRng = RandomNumGen(self.distGame.doId + serialNum * 10)
|
||||
suit = CogdoMazeSlowMinionSuit(serialNum, self.maze, suitRng, difficulty, startTile=suitSpawnSpot[2][i])
|
||||
self.addSuit(suit)
|
||||
|
@ -304,7 +304,7 @@ class CogdoMazeGame(DirectObject):
|
|||
|
||||
def __updateGags(self):
|
||||
remove = []
|
||||
for i in range(len(self.gags)):
|
||||
for i in xrange(len(self.gags)):
|
||||
balloon = self.gags[i]
|
||||
if balloon.isSingleton():
|
||||
remove.append(i)
|
||||
|
@ -355,7 +355,7 @@ class CogdoMazeGame(DirectObject):
|
|||
start = math.radians(random.randint(0, 360))
|
||||
step = math.radians(360.0 / numDrops)
|
||||
radius = 2.0
|
||||
for i in range(numDrops):
|
||||
for i in xrange(numDrops):
|
||||
angle = start + i * step
|
||||
x = radius * math.cos(angle) + suit.suit.getX()
|
||||
y = radius * math.sin(angle) + suit.suit.getY()
|
||||
|
|
|
@ -189,7 +189,7 @@ class CogdoMazeBossGui(DirectFrame):
|
|||
self._openDoor.stash()
|
||||
spacingX = codeFrameWidth + codeFrameGap
|
||||
startX = -0.5 * ((self._codeLength - 1) * spacingX - codeFrameGap)
|
||||
for i in range(self._codeLength):
|
||||
for i in xrange(self._codeLength):
|
||||
marker = CogdoMazeBossCodeFrame(i, self._code[i], bossCard)
|
||||
marker.reparentTo(self)
|
||||
marker.setPos(bossCard, startX + spacingX * i, 0, 0)
|
||||
|
|
|
@ -228,8 +228,8 @@ class CogdoMazeBossSuit(CogdoMazeSuit):
|
|||
|
||||
def pickRandomValidSpot(self, r = 5):
|
||||
validSpots = []
|
||||
for x in range(self.TX - r, self.TX + r):
|
||||
for y in range(self.TY - r, self.TY + r):
|
||||
for x in xrange(self.TX - r, self.TX + r):
|
||||
for y in xrange(self.TY - r, self.TY + r):
|
||||
if self.maze.isWalkable(x, y):
|
||||
validSpots.append([x, y])
|
||||
|
||||
|
|
|
@ -143,9 +143,9 @@ def rotateTable(table, angle):
|
|||
t = []
|
||||
width = len(table[0])
|
||||
height = len(table)
|
||||
for j in range(width):
|
||||
for j in xrange(width):
|
||||
row = []
|
||||
for i in range(height):
|
||||
for i in xrange(height):
|
||||
row.append(table[height - 1 - i][j])
|
||||
|
||||
t.append(row)
|
||||
|
@ -160,9 +160,9 @@ def rotateTable(table, angle):
|
|||
t = []
|
||||
width = len(table[0])
|
||||
height = len(table)
|
||||
for j in range(width):
|
||||
for j in xrange(width):
|
||||
row = []
|
||||
for i in range(height):
|
||||
for i in xrange(height):
|
||||
row.append(table[i][width - 1 - j])
|
||||
|
||||
t.append(row)
|
||||
|
|
|
@ -232,7 +232,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
|
|||
self.physicsActivated = 0
|
||||
|
||||
def __straightenCable(self):
|
||||
for linkNum in range(self.numLinks):
|
||||
for linkNum in xrange(self.numLinks):
|
||||
an, anp, cnp = self.activeLinks[linkNum]
|
||||
an.getPhysicsObject().setVelocity(0, 0, 0)
|
||||
z = float(linkNum + 1) / float(self.numLinks) * self.cableLength
|
||||
|
@ -255,7 +255,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
|
|||
self.links = []
|
||||
self.links.append((self.topLink, Point3(0, 0, 0)))
|
||||
anchor = self.topLink
|
||||
for linkNum in range(self.numLinks):
|
||||
for linkNum in xrange(self.numLinks):
|
||||
anchor = self.__makeLink(anchor, linkNum)
|
||||
|
||||
self.collisions.stash()
|
||||
|
@ -551,7 +551,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
|
|||
def startFlicker(self):
|
||||
self.magnetSoundInterval.start()
|
||||
self.lightning = []
|
||||
for i in range(4):
|
||||
for i in xrange(4):
|
||||
t = float(i) / 3.0 - 0.5
|
||||
l = self.craneGame.lightning.copyTo(self.gripper)
|
||||
l.setScale(random.choice([1, -1]), 1, 5)
|
||||
|
@ -680,7 +680,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
|
|||
self.armSmoother.setPos(self.crane.getPos())
|
||||
self.armSmoother.setHpr(self.arm.getHpr())
|
||||
self.armSmoother.setPhonyTimestamp()
|
||||
for linkNum in range(self.numLinks):
|
||||
for linkNum in xrange(self.numLinks):
|
||||
smoother = self.linkSmoothers[linkNum]
|
||||
an, anp, cnp = self.activeLinks[linkNum]
|
||||
smoother.clearPositions(0)
|
||||
|
@ -689,7 +689,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
|
|||
|
||||
def doSmoothTask(self, task):
|
||||
self.armSmoother.computeAndApplySmoothPosHpr(self.crane, self.arm)
|
||||
for linkNum in range(self.numLinks):
|
||||
for linkNum in xrange(self.numLinks):
|
||||
smoother = self.linkSmoothers[linkNum]
|
||||
anp = self.activeLinks[linkNum][1]
|
||||
smoother.computeAndApplySmoothPos(anp)
|
||||
|
@ -716,7 +716,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
|
|||
self.armSmoother.applySmoothPos(self.crane)
|
||||
self.armSmoother.applySmoothHpr(self.arm)
|
||||
self.armSmoother.clearPositions(1)
|
||||
for linkNum in range(self.numLinks):
|
||||
for linkNum in xrange(self.numLinks):
|
||||
smoother = self.linkSmoothers[linkNum]
|
||||
an, anp, cnp = self.activeLinks[linkNum]
|
||||
if smoother.getLatestPosition():
|
||||
|
@ -732,7 +732,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
|
|||
self.armSmoother.setH(h)
|
||||
self.armSmoother.setTimestamp(local)
|
||||
self.armSmoother.markPosition()
|
||||
for linkNum in range(self.numLinks):
|
||||
for linkNum in xrange(self.numLinks):
|
||||
smoother = self.linkSmoothers[linkNum]
|
||||
lp = links[linkNum]
|
||||
smoother.setPos(*lp)
|
||||
|
@ -746,7 +746,7 @@ class DistCogdoCrane(DistributedObject.DistributedObject, FSM.FSM):
|
|||
def d_sendCablePos(self):
|
||||
timestamp = globalClockDelta.getFrameNetworkTime()
|
||||
links = []
|
||||
for linkNum in range(self.numLinks):
|
||||
for linkNum in xrange(self.numLinks):
|
||||
an, anp, cnp = self.activeLinks[linkNum]
|
||||
p = anp.getPos()
|
||||
links.append((p[0], p[1], p[2]))
|
||||
|
|
|
@ -100,7 +100,7 @@ class DistCogdoCraneGame(CogdoCraneGameBase, DistCogdoLevelGame):
|
|||
self.notify.warning('Not a collision node: %s' % repr(cnp))
|
||||
break
|
||||
newCollideMask = newCollideMask | cn.getIntoCollideMask()
|
||||
for i in range(cn.getNumSolids()):
|
||||
for i in xrange(cn.getNumSolids()):
|
||||
solid = cn.getSolid(i)
|
||||
if isinstance(solid, PM.CollisionPolygon):
|
||||
plane = PM.Plane(solid.getPlane())
|
||||
|
|
|
@ -43,7 +43,7 @@ class DistCogdoMazeGame(DistCogdoGame, DistCogdoMazeGameBase):
|
|||
bossCode = None
|
||||
if self._numSuits[0] > 0:
|
||||
bossCode = ''
|
||||
for u in range(self._numSuits[0]):
|
||||
for u in xrange(self._numSuits[0]):
|
||||
bossCode += '%X' % self.randomNumGen.randint(0, 15)
|
||||
|
||||
self.game.load(mazeFactory, self._numSuits, bossCode)
|
||||
|
|
|
@ -37,13 +37,13 @@ class DistCogdoMazeGameAI(DistCogdoGameAI):
|
|||
slowMiniHp = CogdoMazeGameGlobals.SuitData[2]['hp']
|
||||
|
||||
serialNum = 0
|
||||
for i in range(self.numSuits[0]):
|
||||
for i in xrange(self.numSuits[0]):
|
||||
self.bosses[serialNum] = bossHp
|
||||
serialNum += 1
|
||||
for i in range(self.numSuits[1]):
|
||||
for i in xrange(self.numSuits[1]):
|
||||
self.fastMinions[serialNum] = fastMiniHp
|
||||
serialNum += 1
|
||||
for i in range(self.numSuits[2]):
|
||||
for i in xrange(self.numSuits[2]):
|
||||
self.slowMinions[serialNum] = slowMiniHp
|
||||
serialNum += 1
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
|
||||
def setElevatorLights(self, elevatorModel):
|
||||
npc = elevatorModel.findAllMatches('**/floor_light_?;+s')
|
||||
for i in range(npc.getNumPaths()):
|
||||
for i in xrange(npc.getNumPaths()):
|
||||
np = npc.getPath(i)
|
||||
np.setDepthOffset(120)
|
||||
floor = int(np.getName()[-1:]) - 1
|
||||
|
@ -351,7 +351,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
self.notify.warning('setSuits() - no suit: %d' % suitId)
|
||||
|
||||
self.reserveSuits = []
|
||||
for index in range(len(reserveIds)):
|
||||
for index in xrange(len(reserveIds)):
|
||||
suitId = reserveIds[index]
|
||||
if self.cr.doId2do.has_key(suitId):
|
||||
suit = self.cr.doId2do[suitId]
|
||||
|
@ -435,7 +435,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
self.barrelRoom.unload()
|
||||
if self.FOType:
|
||||
penthouseName = SUITE_DICT.get(self.FOType)
|
||||
for i in range(4):
|
||||
for i in xrange(4):
|
||||
self.floorModel = loader.loadModel('phase_5/models/cogdominium/%s' % penthouseName)
|
||||
|
||||
self.cage = self.floorModel.find('**/cage')
|
||||
|
@ -448,17 +448,17 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
self.cageDoor.wrtReparentTo(self.cage)
|
||||
if self.FOType:
|
||||
paintingModelName = PAINTING_DICT.get(self.FOType)
|
||||
for i in range(4):
|
||||
for i in xrange(4):
|
||||
paintingModel = loader.loadModel('phase_5/models/cogdominium/%s' % paintingModelName)
|
||||
loc = self.floorModel.find('**/loc_painting%d' % (i + 1))
|
||||
paintingModel.reparentTo(loc)
|
||||
|
||||
if not self.floorModel.find('**/trophyCase').isEmpty():
|
||||
for i in range(4):
|
||||
for i in xrange(4):
|
||||
goldEmblem = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_goldTrophy.bam')
|
||||
loc = self.floorModel.find('**/gold_0%d' % (i + 1))
|
||||
goldEmblem.reparentTo(loc)
|
||||
for i in range(20):
|
||||
for i in xrange(20):
|
||||
silverEmblem = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_silverTrophy.bam')
|
||||
loc = self.floorModel.find('**/silver_0%d' % (i + 1))
|
||||
silverEmblem.reparentTo(loc)
|
||||
|
@ -509,7 +509,7 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
self.elevIn = elevIn
|
||||
self.elevOut = elevOut
|
||||
self._haveEntranceElevator.set(True)
|
||||
for index in range(len(self.suits)):
|
||||
for index in xrange(len(self.suits)):
|
||||
if not self.suits[index].isEmpty():
|
||||
self.suits[index].setPos(SuitPositions[index])
|
||||
if len(self.suits) > 2:
|
||||
|
@ -779,12 +779,12 @@ class DistributedCogdoInterior(DistributedObject.DistributedObject):
|
|||
pass
|
||||
else:
|
||||
self.notify.warning('Invalid floor number for display badges.')
|
||||
for player in range(len(self.toons)):
|
||||
for player in xrange(len(self.toons)):
|
||||
goldBadge = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_goldTrophy')
|
||||
goldBadge.setScale(1.2)
|
||||
goldNode = render.find('**/gold_0' + str(player + 1))
|
||||
goldBadge.reparentTo(goldNode)
|
||||
for floor in range(numFloors):
|
||||
for floor in xrange(numFloors):
|
||||
silverBadge = loader.loadModel('phase_5/models/cogdominium/tt_m_ara_crg_silverTrophy.bam')
|
||||
silverBadge.setScale(1.2)
|
||||
silverNode = render.find('**/silver_0' + str(floor * 4 + (player + 1)))
|
||||
|
|
|
@ -42,7 +42,7 @@ class SuitPlannerCogdoInteriorAI:
|
|||
|
||||
def __genJoinChances(self, num):
|
||||
joinChances = []
|
||||
for currChance in range(num):
|
||||
for currChance in xrange(num):
|
||||
joinChances.append(random.randint(1, 100))
|
||||
|
||||
joinChances.sort(cmp)
|
||||
|
@ -51,7 +51,7 @@ class SuitPlannerCogdoInteriorAI:
|
|||
def _genSuitInfos(self, numFloors, difficulty, bldgTrack):
|
||||
self.suitInfos = []
|
||||
self.notify.debug('\n\ngenerating suitsInfos with numFloors (' + str(numFloors) + ') difficulty (' + str(difficulty) + '+1) and bldgTrack (' + str(bldgTrack) + ')')
|
||||
for currFloor in range(numFloors):
|
||||
for currFloor in xrange(numFloors):
|
||||
infoDict = {}
|
||||
lvls = self.__genLevelList(difficulty, currFloor, numFloors)
|
||||
activeDicts = []
|
||||
|
@ -76,7 +76,7 @@ class SuitPlannerCogdoInteriorAI:
|
|||
else:
|
||||
revives = 0
|
||||
|
||||
for currActive in range(numActive - 1, -1, -1):
|
||||
for currActive in xrange(numActive - 1, -1, -1):
|
||||
level = lvls[currActive]
|
||||
type = self.__genNormalSuitType(level)
|
||||
activeDict = {}
|
||||
|
@ -90,7 +90,7 @@ class SuitPlannerCogdoInteriorAI:
|
|||
reserveDicts = []
|
||||
numReserve = min(len(lvls) - numActive, getMaxReserves(bldgTrack))
|
||||
joinChances = self.__genJoinChances(numReserve)
|
||||
for currReserve in range(numReserve):
|
||||
for currReserve in xrange(numReserve):
|
||||
level = lvls[currReserve + numActive]
|
||||
type = self.__genNormalSuitType(level)
|
||||
reserveDict = {}
|
||||
|
@ -204,7 +204,7 @@ class SuitPlannerCogdoInteriorAI:
|
|||
|
||||
def genSuits(self):
|
||||
suitHandles = []
|
||||
for floor in range(len(self.suitInfos)):
|
||||
for floor in xrange(len(self.suitInfos)):
|
||||
floorSuitHandles = self.genFloorSuits(floor)
|
||||
suitHandles.append(floorSuitHandles)
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ def getPartName(partArray):
|
|||
|
||||
def isSuitComplete(parts, dept):
|
||||
dept = dept2deptIndex(dept)
|
||||
for p in range(len(PartsQueryMasks)):
|
||||
for p in xrange(len(PartsQueryMasks)):
|
||||
if getNextPart(parts, p, dept):
|
||||
return 0
|
||||
|
||||
|
@ -469,7 +469,7 @@ def getTotalMerits(toon, index):
|
|||
|
||||
def getTotalParts(bitString, shiftWidth = 32):
|
||||
sum = 0
|
||||
for shift in range(0, shiftWidth):
|
||||
for shift in xrange(0, shiftWidth):
|
||||
sum = sum + (bitString >> shift & 1)
|
||||
|
||||
return sum
|
||||
|
@ -488,7 +488,7 @@ def asBitstring(number):
|
|||
shift += 1
|
||||
|
||||
str = ''
|
||||
for i in range(0, len(array)):
|
||||
for i in xrange(0, len(array)):
|
||||
str = str + array[i]
|
||||
|
||||
return str
|
||||
|
@ -496,7 +496,7 @@ def asBitstring(number):
|
|||
|
||||
def asNumber(bitstring):
|
||||
num = 0
|
||||
for i in range(0, len(bitstring)):
|
||||
for i in xrange(0, len(bitstring)):
|
||||
if bitstring[i] == '1':
|
||||
num += pow(2, len(bitstring) - 1 - i)
|
||||
|
||||
|
|
|
@ -1510,7 +1510,7 @@ class DistributedCannon(DistributedObject.DistributedObject):
|
|||
(0, 1, 5, 4),
|
||||
(0, 4, 7, 3),
|
||||
(1, 2, 6, 5)]
|
||||
for i in range(len(vertices)):
|
||||
for i in xrange(len(vertices)):
|
||||
vertex = vertices[i]
|
||||
vertexWriter.addData3f(vertex[0], vertex[1], vertex[2])
|
||||
colorWriter.addData4f(*colors[i])
|
||||
|
|
|
@ -376,7 +376,7 @@ class DistributedPhone(DistributedFurnitureItem.DistributedFurnitureItem):
|
|||
w = 0.05
|
||||
shakeOnce = Sequence(Func(phone.setR, r), Wait(w), Func(phone.setR, -r), Wait(w))
|
||||
shakeSeq = Sequence()
|
||||
for i in range(16):
|
||||
for i in xrange(16):
|
||||
shakeSeq.append(shakeOnce)
|
||||
|
||||
ringIval = Parallel(Func(base.playSfx, self.ringSfx), shakeSeq, Func(phone.setR, 0))
|
||||
|
|
|
@ -263,7 +263,7 @@ class LoadEstateFSM(FSM):
|
|||
|
||||
def enterLoadPets(self):
|
||||
self.petFSMs = []
|
||||
for houseIndex in range(6):
|
||||
for houseIndex in xrange(6):
|
||||
toon = self.toons[houseIndex]
|
||||
if toon and toon['setPetId'][0] != 0:
|
||||
fsm = LoadPetFSM(self.mgr, self.estate, toon, self.__petDone)
|
||||
|
|
|
@ -177,8 +177,8 @@ class GardenDropGame:
|
|||
currentClosest = None
|
||||
currentDist = 10000000
|
||||
|
||||
for countX in range(GardenGameGlobals.gridDimX):
|
||||
for countZ in range(GardenGameGlobals.gridDimZ):
|
||||
for countX in xrange(GardenGameGlobals.gridDimX):
|
||||
for countZ in xrange(GardenGameGlobals.gridDimZ):
|
||||
testDist = self.testPointDistanceSquare(x, z, self.grid[countX][countZ][1], self.grid[countX][countZ][2])
|
||||
if self.grid[countX][countZ][0] == None and testDist < currentDist and (force or self.hasNeighbor(countX, countZ)):
|
||||
currentClosest = self.grid[countX][countZ]
|
||||
|
@ -323,8 +323,8 @@ class GardenDropGame:
|
|||
self.tick = 0
|
||||
sizeSprites = len(self.sprites)
|
||||
|
||||
for movingSpriteIndex in range(len(self.sprites)):
|
||||
for testSpriteIndex in range(movingSpriteIndex, len(self.sprites)):
|
||||
for movingSpriteIndex in xrange(len(self.sprites)):
|
||||
for testSpriteIndex in xrange(movingSpriteIndex, len(self.sprites)):
|
||||
movingSprite = self.getSprite(movingSpriteIndex)
|
||||
testSprite = self.getSprite(testSpriteIndex)
|
||||
|
||||
|
@ -494,7 +494,7 @@ class GardenDropGame:
|
|||
self.cogSprite = self.addUnSprite(self.block, posX=0.25, posZ=0.5)
|
||||
self.cogSprite.setColor(GardenGameGlobals.colorBlack)
|
||||
|
||||
for ball in range(0, levelNum):
|
||||
for ball in xrange(0, levelNum):
|
||||
place = random.random() * GardenGameGlobals.rangeX
|
||||
self.newSprite = self.addSprite(self.block, size=0.5, posX=GardenGameGlobals.minX + place, posZ=0.0, found=1)
|
||||
self.stickInGrid(self.newSprite, 1)
|
||||
|
@ -512,9 +512,9 @@ class GardenDropGame:
|
|||
size = 0.085
|
||||
sizeZ = size * 0.8
|
||||
|
||||
for countX in range(GardenGameGlobals.gridDimX):
|
||||
for countX in xrange(GardenGameGlobals.gridDimX):
|
||||
newRow = []
|
||||
for countZ in range(GardenGameGlobals.gridDimZ):
|
||||
for countZ in xrange(GardenGameGlobals.gridDimZ):
|
||||
offset = 0
|
||||
if countZ % 2 == 0:
|
||||
offset = size / 2
|
||||
|
|
|
@ -92,7 +92,7 @@ class AvatarChooser(StateData.StateData):
|
|||
used_position_indexs.append(av.position)
|
||||
self.panelList.append(panel)
|
||||
|
||||
for panelNum in range(0, MAX_AVATARS):
|
||||
for panelNum in xrange(0, MAX_AVATARS):
|
||||
if panelNum not in used_position_indexs:
|
||||
panel = AvatarChoice.AvatarChoice(position=panelNum)
|
||||
panel.setPos(POSITIONS[panelNum])
|
||||
|
@ -122,7 +122,7 @@ class AvatarChooser(StateData.StateData):
|
|||
return toonHead.getRandomForwardLookAtPoint()
|
||||
else:
|
||||
other_toon_idxs = []
|
||||
for i in range(len(self.IsLookingAt)):
|
||||
for i in xrange(len(self.IsLookingAt)):
|
||||
if self.IsLookingAt[i] == toonidx:
|
||||
other_toon_idxs.append(i)
|
||||
|
||||
|
@ -171,7 +171,7 @@ class AvatarChooser(StateData.StateData):
|
|||
if len(self.used_panel_indexs) == 0:
|
||||
return
|
||||
self.IsLookingAt = []
|
||||
for i in range(MAX_AVATARS):
|
||||
for i in xrange(MAX_AVATARS):
|
||||
self.IsLookingAt.append('f')
|
||||
|
||||
for panel in self.panelList:
|
||||
|
|
|
@ -289,7 +289,7 @@ class Pet(Avatar.Avatar):
|
|||
self.moodIcons.setZ(3.5)
|
||||
|
||||
moods = moodIcons.findAllMatches('**/+GeomNode')
|
||||
for moodNum in range(0, moods.getNumPaths()):
|
||||
for moodNum in xrange(0, moods.getNumPaths()):
|
||||
mood = moods.getPath(moodNum)
|
||||
mood.reparentTo(self.moodIcons)
|
||||
mood.setBillboardPointEye()
|
||||
|
@ -650,7 +650,7 @@ def gridPets():
|
|||
offsetX = 0
|
||||
offsetY = 0
|
||||
startPos = base.localAvatar.getPos()
|
||||
for body in range(0, len(BodyTypes)):
|
||||
for body in xrange(0, len(BodyTypes)):
|
||||
colors = getColors(body)
|
||||
for color in colors:
|
||||
p = Pet()
|
||||
|
|
|
@ -324,7 +324,7 @@ class PetshopGUI(DirectObject):
|
|||
self.petName = []
|
||||
self.petDesc = []
|
||||
self.petCost = []
|
||||
for i in range(self.numPets):
|
||||
for i in xrange(self.numPets):
|
||||
random.seed(self.petSeeds[i])
|
||||
zoneId = ZoneUtil.getCanonicalSafeZoneId(base.localAvatar.getZoneId())
|
||||
name, dna, traitSeed = PetUtil.getPetInfoFromSeed(self.petSeeds[i], zoneId)
|
||||
|
|
|
@ -95,7 +95,7 @@ class DistributedCheckers(DistributedNode.DistributedNode):
|
|||
x = self.boardNode.find('**/locator*')
|
||||
self.locatorList = x.getChildren()
|
||||
tempList = []
|
||||
for x in range(0, 32):
|
||||
for x in xrange(0, 32):
|
||||
self.locatorList[x].setTag('GamePeiceLocator', '%d' % x)
|
||||
tempList.append(self.locatorList[x].attachNewNode(CollisionNode('picker%d' % x)))
|
||||
tempList[x].node().addSolid(CollisionSphere(0, 0, 0, 0.39))
|
||||
|
@ -451,7 +451,7 @@ class DistributedCheckers(DistributedNode.DistributedNode):
|
|||
|
||||
def existsLegalJumpsFrom(self, index, peice):
|
||||
if peice == 'king':
|
||||
for x in range(4):
|
||||
for x in xrange(4):
|
||||
if self.board.squareList[index].getAdjacent()[x] != None and \
|
||||
self.board.squareList[index].getJumps()[x] != None:
|
||||
adj = self.board.squareList[self.board.squareList[index].getAdjacent()[x]]
|
||||
|
@ -513,7 +513,7 @@ class DistributedCheckers(DistributedNode.DistributedNode):
|
|||
else:
|
||||
moveForward = [0, 3]
|
||||
if peice == 'king':
|
||||
for x in range(4):
|
||||
for x in xrange(4):
|
||||
if firstSquare.getAdjacent()[x] != None:
|
||||
if self.board.squareList[firstSquare.getAdjacent()[x]].getState() == 0 and secondSquare.getNum() in firstSquare.getAdjacent():
|
||||
return True
|
||||
|
@ -583,7 +583,7 @@ class DistributedCheckers(DistributedNode.DistributedNode):
|
|||
self.playerNum = 1
|
||||
self.playerColorString = 'white'
|
||||
isObserve = True
|
||||
for xx in range(32):
|
||||
for xx in xrange(32):
|
||||
for blah in self.locatorList[xx].getChildren():
|
||||
blah.hide()
|
||||
if self.locatorList[xx].getChildren().index(blah) != 0:
|
||||
|
@ -671,7 +671,7 @@ class DistributedCheckers(DistributedNode.DistributedNode):
|
|||
return
|
||||
|
||||
def hideChildren(self, nodeList):
|
||||
for x in range(1, 2):
|
||||
for x in xrange(1, 2):
|
||||
nodeList[x].hide()
|
||||
|
||||
def animatePeice(self, tableState, moveList, type, playerColor):
|
||||
|
@ -693,7 +693,7 @@ class DistributedCheckers(DistributedNode.DistributedNode):
|
|||
|
||||
checkersPeiceTrack = Sequence()
|
||||
length = len(moveList)
|
||||
for x in range(length - 1):
|
||||
for x in xrange(length - 1):
|
||||
checkersPeiceTrack.append(Parallel(SoundInterval(self.moveSound), ProjectileInterval(gamePeiceForAnimation, endPos=self.locatorList[moveList[x + 1]].getPos(), duration=0.5)))
|
||||
|
||||
checkersPeiceTrack.append(Func(gamePeiceForAnimation.removeNode))
|
||||
|
|
|
@ -346,7 +346,7 @@ class DistributedCheckersAI(DistributedNodeAI):
|
|||
if self.checkLegalMove(firstSquare, secondSquare, moveType) == True:
|
||||
return True
|
||||
else:
|
||||
for x in range(len(moveList) - 1):
|
||||
for x in xrange(len(moveList) - 1):
|
||||
y = self.checkLegalJump(self.board.getSquare(moveList[x]), self.board.getSquare(moveList[x + 1]), moveType)
|
||||
if y == False:
|
||||
return False
|
||||
|
@ -355,7 +355,7 @@ class DistributedCheckersAI(DistributedNodeAI):
|
|||
return False
|
||||
|
||||
elif len(moveList) > 2:
|
||||
for x in range(len(moveList) - 1):
|
||||
for x in xrange(len(moveList) - 1):
|
||||
y = self.checkLegalJump(self.board.getSquare(moveList[x]), self.board.getSquare(moveList[x + 1]), moveType)
|
||||
if y == False:
|
||||
return False
|
||||
|
@ -366,7 +366,7 @@ class DistributedCheckersAI(DistributedNodeAI):
|
|||
|
||||
|
||||
def makeMove(self, moveList):
|
||||
for x in range(len(moveList) - 1):
|
||||
for x in xrange(len(moveList) - 1):
|
||||
firstSquare = self.board.squareList[moveList[x]]
|
||||
secondSquare = self.board.squareList[moveList[x + 1]]
|
||||
if firstSquare.getNum() in secondSquare.getAdjacent():
|
||||
|
@ -489,7 +489,7 @@ class DistributedCheckersAI(DistributedNodeAI):
|
|||
|
||||
def existsLegalJumpsFrom(self, index, peice):
|
||||
if peice == 'king':
|
||||
for x in range(4):
|
||||
for x in xrange(4):
|
||||
if self.board.squareList[index].getAdjacent()[x] != None and self.board.squareList[index].getJumps()[x] != None:
|
||||
adj = self.board.squareList[self.board.squareList[index].getAdjacent()[x]]
|
||||
jump = self.board.squareList[self.board.squareList[index].getJumps()[x]]
|
||||
|
@ -564,7 +564,7 @@ class DistributedCheckersAI(DistributedNodeAI):
|
|||
|
||||
def existsLegalJumpsFrom(self, index, peice):
|
||||
if peice == 'king':
|
||||
for x in range(4):
|
||||
for x in xrange(4):
|
||||
if self.board.squareList[index].getAdjacent()[x] != None and self.board.squareList[index].getJumps()[x] != None:
|
||||
adj = self.board.squareList[self.board.squareList[index].getAdjacent()[x]]
|
||||
jump = self.board.squareList[self.board.squareList[index].getJumps()[x]]
|
||||
|
@ -615,7 +615,7 @@ class DistributedCheckersAI(DistributedNodeAI):
|
|||
0,
|
||||
3]
|
||||
if peice == 'king':
|
||||
for x in range(4):
|
||||
for x in xrange(4):
|
||||
if firstSquare.getAdjacent()[x] != None:
|
||||
if self.board.squareList[firstSquare.getAdjacent()[x]].getState() == 0:
|
||||
return True
|
||||
|
|
|
@ -143,7 +143,7 @@ class DistributedChineseCheckers(DistributedNode.DistributedNode):
|
|||
x = self.boardNode.find('**/locators')
|
||||
self.locatorList = x.getChildren()
|
||||
tempList = []
|
||||
for x in range(0, 121):
|
||||
for x in xrange(0, 121):
|
||||
self.locatorList[x].setTag('GamePeiceLocator', '%d' % x)
|
||||
tempList.append(self.locatorList[x].attachNewNode(CollisionNode('picker%d' % x)))
|
||||
tempList[x].node().addSolid(CollisionSphere(0, 0, 0, 0.115))
|
||||
|
@ -299,7 +299,7 @@ class DistributedChineseCheckers(DistributedNode.DistributedNode):
|
|||
|
||||
def announceSeatPositions(self, playerPos):
|
||||
self.playerSeats = playerPos
|
||||
for x in range(6):
|
||||
for x in xrange(6):
|
||||
pos = self.table.seats[x].getPos(render)
|
||||
renderedPeice = loader.loadModel('phase_6/models/golf/checker_marble.bam')
|
||||
renderedPeice.reparentTo(self.playerTags)
|
||||
|
@ -640,7 +640,7 @@ class DistributedChineseCheckers(DistributedNode.DistributedNode):
|
|||
self.board.setStates(squares)
|
||||
self.mySquares = []
|
||||
messenger.send('wakeup')
|
||||
for x in range(121):
|
||||
for x in xrange(121):
|
||||
self.locatorList[x].clearColor()
|
||||
owner = self.board.squareList[x].getState()
|
||||
if owner == self.playerNum:
|
||||
|
@ -674,7 +674,7 @@ class DistributedChineseCheckers(DistributedNode.DistributedNode):
|
|||
self.locatorList[moveList[0]].hide()
|
||||
checkersPeiceTrack = Sequence()
|
||||
length = len(moveList)
|
||||
for x in range(length - 1):
|
||||
for x in xrange(length - 1):
|
||||
checkersPeiceTrack.append(Parallel(SoundInterval(self.moveSound), ProjectileInterval(gamePeiceForAnimation, endPos=self.locatorList[moveList[x + 1]].getPos(), duration=0.5)))
|
||||
|
||||
checkersPeiceTrack.append(Func(gamePeiceForAnimation.removeNode))
|
||||
|
|
|
@ -557,7 +557,7 @@ class DistributedChineseCheckersAI(DistributedNodeAI):
|
|||
0,
|
||||
0,
|
||||
0]
|
||||
for x in range(6):
|
||||
for x in xrange(6):
|
||||
id = self.playersGamePos[x]
|
||||
if id != None:
|
||||
playerSeatPos[self.parent.seats.index(id)] = x + 1
|
||||
|
@ -614,7 +614,7 @@ class DistributedChineseCheckersAI(DistributedNodeAI):
|
|||
elif self.board.squareList[moveList[0]].getState() == 0:
|
||||
return False
|
||||
|
||||
for x in range(len(moveList) - 1):
|
||||
for x in xrange(len(moveList) - 1):
|
||||
y = self.checkLegalMove(self.board.getSquare(moveList[x]), self.board.getSquare(moveList[x + 1]))
|
||||
if y == False:
|
||||
return False
|
||||
|
|
|
@ -346,7 +346,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
if self.board[0][moveColumn] != 0:
|
||||
self.sendUpdateToAvatarId(avId, 'illegalMove', [])
|
||||
|
||||
for x in range(6):
|
||||
for x in xrange(6):
|
||||
if self.board[x][moveColumn] == 0:
|
||||
movePos = x
|
||||
continue
|
||||
|
@ -377,7 +377,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
|
||||
def checkForTie(self):
|
||||
for x in range(7):
|
||||
for x in xrange(7):
|
||||
if self.board[0][x] == 0:
|
||||
return False
|
||||
continue
|
||||
|
@ -485,7 +485,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
def checkHorizontal(self, rVal, cVal, playerNum):
|
||||
if cVal == 3:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal][cVal - x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -493,7 +493,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
return True
|
||||
continue
|
||||
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal][cVal + x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -503,7 +503,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
return False
|
||||
elif cVal == 2:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal][cVal + x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -513,7 +513,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
return False
|
||||
elif cVal == 4:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal][cVal - x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -528,7 +528,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
def checkVertical(self, rVal, cVal, playerNum):
|
||||
if rVal == 2:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal + x][cVal] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -538,7 +538,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
return False
|
||||
elif rVal == 3:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal - x][cVal] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -554,7 +554,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
def checkDiagonal(self, rVal, cVal, playerNum):
|
||||
if cVal <= 2:
|
||||
if rVal == 2:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal + x][cVal + x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -564,7 +564,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
return False
|
||||
elif rVal == 3:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal - x][cVal + x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -576,7 +576,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
elif cVal >= 4:
|
||||
if rVal == 2:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal + x][cVal - x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -586,7 +586,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
return False
|
||||
elif rVal == 3:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal - x][cVal - x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -597,7 +597,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
return False
|
||||
|
||||
elif rVal == 3 and rVal == 4 or rVal == 5:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal - x][cVal - x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -605,7 +605,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
return True
|
||||
continue
|
||||
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal + x][cVal - x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -615,7 +615,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
|
||||
return False
|
||||
elif rVal == 0 and rVal == 1 or rVal == 2:
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal + x][cVal - x] != playerNum:
|
||||
break
|
||||
|
||||
|
@ -623,7 +623,7 @@ class DistributedFindFourAI(DistributedNodeAI):
|
|||
return True
|
||||
continue
|
||||
|
||||
for x in range(1, 4):
|
||||
for x in xrange(1, 4):
|
||||
if self.board[rVal + x][cVal + x] != playerNum:
|
||||
break
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ class DistributedPicnicTableAI(DistributedNodeAI):
|
|||
self.allowPickers = []
|
||||
self.pickGame(gameNum)
|
||||
if self.game:
|
||||
for x in range(numPickers):
|
||||
for x in xrange(numPickers):
|
||||
self.game.informGameOfPlayer()
|
||||
|
||||
def pickGame(self, gameNum):
|
||||
|
@ -313,7 +313,7 @@ class DistributedPicnicTableAI(DistributedNodeAI):
|
|||
self.hasPicked = False
|
||||
|
||||
def findAvatar(self, avId):
|
||||
for i in range(len(self.seats)):
|
||||
for i in xrange(len(self.seats)):
|
||||
if self.seats[i] == avId:
|
||||
return i
|
||||
continue
|
||||
|
@ -328,7 +328,7 @@ class DistributedPicnicTableAI(DistributedNodeAI):
|
|||
return avCounter
|
||||
|
||||
def findAvailableSeat(self):
|
||||
for i in range(len(self.seats)):
|
||||
for i in xrange(len(self.seats)):
|
||||
if self.seats[i] == None:
|
||||
return i
|
||||
continue
|
||||
|
|
|
@ -70,11 +70,11 @@ class DisguisePage(ShtikerPage.ShtikerPage):
|
|||
self.cogLevel = DirectLabel(parent=self.frame, relief=None, text='', text_font=ToontownGlobals.getSuitFont(), text_scale=0.09, text_align=TextNode.ACenter, pos=(-0.91, 0, -1.02))
|
||||
self.partFrame = DirectFrame(parent=self.frame, relief=None)
|
||||
self.parts = []
|
||||
for partNum in range(0, NumParts):
|
||||
for partNum in xrange(0, NumParts):
|
||||
self.parts.append(DirectFrame(parent=self.partFrame, relief=None, geom=gui.find('**/robot/' + PartNames[partNum])))
|
||||
|
||||
self.holes = []
|
||||
for partNum in range(0, NumParts):
|
||||
for partNum in xrange(0, NumParts):
|
||||
self.holes.append(DirectFrame(parent=self.partFrame, relief=None, geom=gui.find('**/robot_hole/' + PartNames[partNum])))
|
||||
|
||||
self.cogPartRatio = DirectLabel(parent=self.frame, relief=None, text='', text_font=ToontownGlobals.getSuitFont(), text_scale=0.08, text_align=TextNode.ACenter, pos=(-0.91, 0, -0.82))
|
||||
|
@ -163,7 +163,7 @@ class DisguisePage(ShtikerPage.ShtikerPage):
|
|||
def doTab(self, index):
|
||||
self.activeTab = index
|
||||
self.tabs[index].reparentTo(self.pageFrame)
|
||||
for i in range(len(self.tabs)):
|
||||
for i in xrange(len(self.tabs)):
|
||||
tab = self.tabs[i]
|
||||
if i == index:
|
||||
tab['text0_fg'] = (1, 0, 0, 1)
|
||||
|
|
|
@ -4056,7 +4056,7 @@ def hp(hp):
|
|||
invoker = spellbook.getInvoker()
|
||||
maxHp = invoker.getMaxHp()
|
||||
if not -1 <= hp <= maxHp:
|
||||
return 'HP must be in range (-1-%d).' % maxHp
|
||||
return 'HP must be in xrange (-1-%d).' % maxHp
|
||||
invoker.b_setHp(hp)
|
||||
return 'Set your HP to: %d' % hp
|
||||
|
||||
|
@ -4066,7 +4066,7 @@ def maxHp(maxHp):
|
|||
Modify the invoker's max HP.
|
||||
"""
|
||||
if not 15 <= maxHp <= ToontownGlobals.MaxHpLimit:
|
||||
return 'HP must be in range (15-%d).' % ToontownGlobals.MaxHpLimit
|
||||
return 'HP must be in xrange (15-%d).' % ToontownGlobals.MaxHpLimit
|
||||
invoker = spellbook.getTarget()
|
||||
invoker.b_setHp(maxHp)
|
||||
invoker.b_setMaxHp(maxHp)
|
||||
|
@ -4223,7 +4223,7 @@ def sos(count, name):
|
|||
"""
|
||||
invoker = spellbook.getInvoker()
|
||||
if not 0 <= count <= 100:
|
||||
return 'Your SOS count must be in range (0-100).'
|
||||
return 'Your SOS count must be in xrange (0-100).'
|
||||
for npcId, npcName in TTLocalizer.NPCToonNames.items():
|
||||
if name.lower() == npcName.lower():
|
||||
if npcId not in NPCToons.npcFriends:
|
||||
|
@ -4255,7 +4255,7 @@ def fires(count):
|
|||
"""
|
||||
invoker = spellbook.getInvoker()
|
||||
if not 0 <= count <= 255:
|
||||
return 'Your fire count must be in range (0-255).'
|
||||
return 'Your fire count must be in xrange (0-255).'
|
||||
invoker.b_setPinkSlips(count)
|
||||
return 'You were given %d fires.' % count
|
||||
|
||||
|
@ -4447,7 +4447,7 @@ def tickets(tickets):
|
|||
Set the invoker's racing tickets value.
|
||||
"""
|
||||
if not 0 <= tickets <= 99999:
|
||||
return 'Racing tickets value must be in range (0-99999).'
|
||||
return 'Racing tickets value must be in xrange (0-99999).'
|
||||
invoker = spellbook.getInvoker()
|
||||
invoker.b_setTickets(tickets)
|
||||
return 'Set your tickets to: %d' % tickets
|
||||
|
@ -4714,7 +4714,7 @@ def givePies(pieType, numPies=0):
|
|||
target.b_setNumPies(0)
|
||||
return "Removed %s's pies." % target.getName()
|
||||
if not 0 <= pieType <= 7:
|
||||
return 'Pie type must be in range (0-7).'
|
||||
return 'Pie type must be in xrange (0-7).'
|
||||
if not -1 <= numPies <= 99:
|
||||
return 'Pie count out of range (-1-99).'
|
||||
target.b_setPieType(pieType)
|
||||
|
|
|
@ -59,7 +59,7 @@ def describeException(backTrace = 4):
|
|||
lnotab = array.array('B', code.co_lnotab)
|
||||
|
||||
line = code.co_firstlineno
|
||||
for i in range(0, len(lnotab), 2):
|
||||
for i in xrange(0, len(lnotab), 2):
|
||||
byte -= lnotab[i]
|
||||
if byte <= 0:
|
||||
return line
|
||||
|
@ -91,7 +91,7 @@ def describeException(backTrace = 4):
|
|||
stack.append("%s:%s, " % (module, lineno))
|
||||
|
||||
description = ""
|
||||
for i in range(len(stack) - 1, max(len(stack) - backTrace, 0) - 1, -1):
|
||||
for i in xrange(len(stack) - 1, max(len(stack) - backTrace, 0) - 1, -1):
|
||||
description += stack[i]
|
||||
|
||||
description += "%s: %s" % (exceptionName, extraInfo)
|
||||
|
|
|
@ -287,7 +287,7 @@ class TownLoader(StateData.StateData):
|
|||
for i in nodeList:
|
||||
animPropNodes = i.findAllMatches('**/animated_prop_*')
|
||||
numAnimPropNodes = animPropNodes.getNumPaths()
|
||||
for j in range(numAnimPropNodes):
|
||||
for j in xrange(numAnimPropNodes):
|
||||
animPropNode = animPropNodes.getPath(j)
|
||||
if animPropNode.getName().startswith('animated_prop_generic'):
|
||||
className = 'GenericAnimatedProp'
|
||||
|
|
Loading…
Reference in a new issue