From 8642e4d0af433a7fde5d7c2d5c070a5b4b59d959 Mon Sep 17 00:00:00 2001 From: Nicolas Sanchez <98576999+nicolassanchez02@users.noreply.github.com> Date: Fri, 29 May 2026 20:19:47 -0500 Subject: [PATCH] Use // where Python 2 int division was assumed Several spots ported from Python 2 use / on ints and feed the result somewhere that requires an int. In Python 3 / is true division and yields a float, so these raise TypeError when the line runs. - fishing/NormalBingo, DiagonalBingo, ThreewayBingo: id = self.cardSize / 2 produces 12.5; in NormalBingo that float flows through checkForWin into colCheck's 1 << ... + colId and crashes when the BINGO button is pressed. Also fixed the center-row skip NormalBingo CARD_ROWS / 2. - safezone/Train: random.randrange(4, (self.MarkDelta - waitTime) / 2) passes a float bound to randrange (Cashbot HQ exterior train), raising TypeError. - shtiker/EventsPage: range(len(urls) / 2) passes a float to range() on the blocking news-download path. All changed to //. --- toontown/fishing/DiagonalBingo.py | 2 +- toontown/fishing/NormalBingo.py | 4 ++-- toontown/fishing/ThreewayBingo.py | 2 +- toontown/safezone/Train.py | 2 +- toontown/shtiker/EventsPage.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/toontown/fishing/DiagonalBingo.py b/toontown/fishing/DiagonalBingo.py index f5b8063..98d30f4 100644 --- a/toontown/fishing/DiagonalBingo.py +++ b/toontown/fishing/DiagonalBingo.py @@ -24,7 +24,7 @@ class DiagonalBingo(BingoCardBase.BingoCardBase): return self.onFDiag(id) | self.onBDiag(id) def checkForBingo(self): - id = self.cardSize / 2 + id = self.cardSize // 2 if self.checkForWin(id): return BingoGlobals.WIN return BingoGlobals.NO_UPDATE diff --git a/toontown/fishing/NormalBingo.py b/toontown/fishing/NormalBingo.py index 5633b37..71cea7d 100644 --- a/toontown/fishing/NormalBingo.py +++ b/toontown/fishing/NormalBingo.py @@ -24,11 +24,11 @@ class NormalBingo(BingoCardBase.BingoCardBase): return 1 def checkForBingo(self): - id = self.cardSize / 2 + id = self.cardSize // 2 if self.checkForWin(id): return BingoGlobals.WIN for i in range(BingoGlobals.CARD_ROWS): - if i != BingoGlobals.CARD_ROWS / 2: + if i != BingoGlobals.CARD_ROWS // 2: rowResult = self.rowCheck(i) colResult = self.colCheck(i) if rowResult | colResult: diff --git a/toontown/fishing/ThreewayBingo.py b/toontown/fishing/ThreewayBingo.py index 515f98f..30b0931 100644 --- a/toontown/fishing/ThreewayBingo.py +++ b/toontown/fishing/ThreewayBingo.py @@ -29,7 +29,7 @@ class ThreewayBingo(BingoCardBase.BingoCardBase): return self.onRow(2, id) | self.onFDiag(id) | self.onBDiag(id) def checkForBingo(self): - id = self.cardSize / 2 + id = self.cardSize // 2 if self.checkForWin(id): return BingoGlobals.WIN return BingoGlobals.NO_UPDATE diff --git a/toontown/safezone/Train.py b/toontown/safezone/Train.py index a82b23f..cb4fa6a 100644 --- a/toontown/safezone/Train.py +++ b/toontown/safezone/Train.py @@ -112,7 +112,7 @@ class Train(DirectObject): nextRun = Sequence(Func(self.__showStart)) if trainShouldStop == 0: waitTime = 3 - totalTime = random.randrange(4, (self.MarkDelta - waitTime) / 2) + totalTime = random.randrange(4, (self.MarkDelta - waitTime) // 2) sfxStopTime = 4.3 halfway = (self.trackStartPos + self.trackEndPos) / 2 halfway.setX(150) diff --git a/toontown/shtiker/EventsPage.py b/toontown/shtiker/EventsPage.py index b95da74..4038523 100644 --- a/toontown/shtiker/EventsPage.py +++ b/toontown/shtiker/EventsPage.py @@ -779,7 +779,7 @@ class EventsPage(ShtikerPage.ShtikerPage): urlStrings = urlfile.read() urlfile.close() urls = urlStrings.split('\r\n') - for index in range(len(urls) / 2): + for index in range(len(urls) // 2): imageUrl = urls[index * 2] textUrl = urls[index * 2 + 1] img = PNMImage()