From 162aa11a0904de9917202b43a6aaf69a222bd019 Mon Sep 17 00:00:00 2001 From: DenialMC Date: Sat, 25 Apr 2015 15:18:30 +0300 Subject: [PATCH] Remove from disconnect reason dictionary if using DisconnectNone --- otp/ai/TimeManagerAI.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/otp/ai/TimeManagerAI.py b/otp/ai/TimeManagerAI.py index d7e9205d..6ebd9a63 100644 --- a/otp/ai/TimeManagerAI.py +++ b/otp/ai/TimeManagerAI.py @@ -1,6 +1,7 @@ from direct.directnotify import DirectNotifyGlobal from direct.distributed.DistributedObjectAI import DistributedObjectAI from direct.distributed.ClockDelta import globalClockDelta +from otp.otpbase import OTPGlobals import time class TimeManagerAI(DistributedObjectAI): @@ -14,7 +15,12 @@ class TimeManagerAI(DistributedObjectAI): self.sendUpdateToAvatarId(self.air.getAvatarIdFromSender(), 'serverTime', [context, globalClockDelta.getRealNetworkTime(bits=32), int(time.time())]) def setDisconnectReason(self, reason): - self.avId2DcReason[self.air.getAvatarIdFromSender()] = reason + avId = self.air.getAvatarIdFromSender() + + if reason == OTPGlobals.DisconnectNone and avId in self.avId2DcReason: + del self.avId2DcReason[avId] + else: + self.avId2DcReason[avId] = reason def setExceptionInfo(self, exception): avId = self.air.getAvatarIdFromSender()