From 5c776d6cc8a7efaad320f6d22b0bf345f3dc1af4 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 5 Aug 2015 03:55:11 -0400 Subject: [PATCH] Fix a mistake I made. --- toontown/building/DistributedBuildingMgrAI.py | 9 +++------ toontown/racing/LeaderboardMgrAI.py | 11 ++++++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/toontown/building/DistributedBuildingMgrAI.py b/toontown/building/DistributedBuildingMgrAI.py index 57428dfc..cda908a6 100755 --- a/toontown/building/DistributedBuildingMgrAI.py +++ b/toontown/building/DistributedBuildingMgrAI.py @@ -205,20 +205,17 @@ class DistributedBuildingMgrAI: def load(self): blocks = {} - if not self.air.dbConn: blocks = simbase.backups.load('block-info', (self.air.districtId, self.branchId), default={}) return blocks - self.air.mongodb.toontown.blockinfo.ensure_index([('ai', 1), ('branch', 1)]) - street = {'ai': self.shard, 'branch': self.branchID} try: doc = self.air.mongodb.toontown.blockinfo.find_one(street) except AutoReconnect: return blocks - if not doc: return blocks - - return doc + for building in doc.get('buildings', []): + blocks[int(building['block'])] = building + return blocks diff --git a/toontown/racing/LeaderboardMgrAI.py b/toontown/racing/LeaderboardMgrAI.py index 682dac40..8e1e4079 100644 --- a/toontown/racing/LeaderboardMgrAI.py +++ b/toontown/racing/LeaderboardMgrAI.py @@ -6,7 +6,16 @@ class LeaderboardMgrAI: def __init__(self, air): self.air = air - self.database = simbase.backups.load('leaderboard', (self.air.districtId,), default=({})) + self.database = {} + if not self.air.dbConn: + self.database = simbase.backups.load('leaderboard', (self.air.districtId,), default=({})) + else: + self.air.mongodb.toontown.leaderboard.ensure_index([('ai', 1)]) + street = {'ai': self.air.districtId} + try: + doc = self.air.mongodb.toontown.leaderboard.find_one(street) + except AutoReconnect: + return blocks def getDatabase(self): return self.database