verbose error msgs when model and spec get out-of-sync

This commit is contained in:
Darren Ranalli 2003-12-16 22:24:04 +00:00
parent b4c9aa5cab
commit 1d31baefae
2 changed files with 16 additions and 4 deletions

View File

@ -147,6 +147,14 @@ class DistributedLevel(DistributedObject.DistributedObject,
self.privGotSpec(levelSpec)
if __dev__:
def reportModelSpecSyncError(self, msg):
DistributedLevel.notify.error(
'%s\n'
'\n'
'your spec does not match the level model\n'
'use SpecUtil.updateSpec, then restart your AI and client' %
(msg))
def setSpecDeny(self, reason):
DistributedLevel.notify.error(reason)
@ -186,9 +194,8 @@ class DistributedLevel(DistributedObject.DistributedObject,
modelZoneNums = self.zoneNums
entityZoneNums = self.zoneNum2entId.keys()
if not sameElements(modelZoneNums, entityZoneNums):
DistributedLevel.notify.error(
'model zone nums (%s) do not match entity zone nums (%s)\n'
'use SpecUtil.updateSpec' %
self.reportModelSpecSyncError(
'model zone nums (%s) do not match entity zone nums (%s)' %
(modelZoneNums, entityZoneNums))
# load stuff
@ -324,7 +331,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
self.stopOuch()
def getZoneNode(self, zoneNum):
return self.zoneNum2node[zoneNum]
return self.zoneNum2node.get(zoneNum)
def requestReparent(self, entity, parentId):
if __debug__:

View File

@ -8,6 +8,11 @@ class ZoneEntity(ZoneEntityBase.ZoneEntityBase, BasicEntities.NodePathAttribs):
ZoneEntityBase.ZoneEntityBase.__init__(self, level, entId)
self.nodePath = self.level.getZoneNode(self.modelZoneNum)
if __dev__:
if self.nodePath is None:
self.level.reportModelSpecSyncError(
'unknown modelZoneNum %s; zone was removed from model?' %
self.modelZoneNum)
BasicEntities.NodePathAttribs.initNodePathAttribs(self, doReparent=0)
# dict of zoneNum to 'visible' reference count