general: fix shard page & news page crash

This commit is contained in:
John Cote 2019-12-30 20:27:42 -05:00
parent 5e0d895680
commit f4f9033f63
3 changed files with 6 additions and 5 deletions

View file

@ -1867,15 +1867,15 @@ class OTPClientRepository(ClientRepositoryBase):
return 0
def listActiveShards(self):
list = []
activeShards = []
for s in list(self.activeDistrictMap.values()):
if s.available:
list.append((s.doId,
activeShards.append((s.doId,
s.name,
s.avatarCount,
s.newAvatarCount))
return list
return activeShards
def getPlayerAvatars(self):
return [ i for i in list(self.doId2do.values()) if isinstance(i, DistributedPlayer) ]

View file

@ -33,7 +33,7 @@ class IssueFrameV2(IssueFrame.IssueFrame):
def isSectionInIndex(self, sectionIdent):
for name in self.newsIndexEntries:
if sectionIdent in name and self.dateStr in name:
if sectionIdent.encode('utf-8') in name and self.dateStr.encode('utf-8') in name:
return True
return False

View file

@ -9,6 +9,7 @@ from toontown.hood import ZoneUtil
from toontown.toonbase import ToontownGlobals
from toontown.distributed import ToontownDistrictStats
from toontown.toontowngui import TTDialog
import functools
POP_COLORS_NTT = (Vec4(0.0, 1.0, 0.0, 1.0), Vec4(1.0, 1.0, 0.0, 1.0), Vec4(1.0, 0.0, 0.0, 1.0))
POP_COLORS = (Vec4(0.4, 0.4, 1.0, 1.0), Vec4(0.4, 1.0, 0.4, 1.0), Vec4(1.0, 0.4, 0.4, 1.0))
@ -181,7 +182,7 @@ class ShardPage(ShtikerPage.ShtikerPage):
else:
return 0
curShardTuples.sort(compareShardTuples)
curShardTuples.sort(key=functools.cmp_to_key(compareShardTuples))
if base.cr.welcomeValleyManager:
curShardTuples.append((ToontownGlobals.WelcomeValleyToken,
TTLocalizer.WelcomeValley[-1],