mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
is valid location tuple
This commit is contained in:
parent
447ab1f557
commit
d240df33f6
@ -200,10 +200,15 @@ class DoCollectionManager:
|
|||||||
assert do.doId not in self.doId2do
|
assert do.doId not in self.doId2do
|
||||||
self.doId2do[do.doId]=do
|
self.doId2do[do.doId]=do
|
||||||
|
|
||||||
if location is not None:
|
if self.isValidLocationTuple(location):
|
||||||
assert do.doId not in self.zoneId2doIds.get(location,{})
|
assert do.doId not in self.zoneId2doIds.get(location,{})
|
||||||
self.zoneId2doIds.setdefault(location, {})
|
self.zoneId2doIds.setdefault(location, {})
|
||||||
self.zoneId2doIds[location][do.doId]=do
|
self.zoneId2doIds[location][do.doId]=do
|
||||||
|
|
||||||
|
def isValidLocationTuple(self, location):
|
||||||
|
return (location is not None
|
||||||
|
and location != (0xffffffff, 0xffffffff)
|
||||||
|
and location != (0, 0))
|
||||||
else:
|
else:
|
||||||
# NON OTP
|
# NON OTP
|
||||||
def addDOToTables(self, do, zoneId=None):
|
def addDOToTables(self, do, zoneId=None):
|
||||||
@ -259,7 +264,7 @@ class DoCollectionManager:
|
|||||||
newLocation = (newParentId, newZoneId)
|
newLocation = (newParentId, newZoneId)
|
||||||
# HACK: DistributedGuildMemberUD starts in -1,-1, which isnt ever put in the
|
# HACK: DistributedGuildMemberUD starts in -1,-1, which isnt ever put in the
|
||||||
# zoneId2doIds table
|
# zoneId2doIds table
|
||||||
if oldLocation != (BAD_DO_ID, BAD_ZONE_ID):
|
if self.isValidLocationTuple(oldLocation):
|
||||||
assert self.notify.debugStateCall(self)
|
assert self.notify.debugStateCall(self)
|
||||||
assert oldLocation in self.zoneId2doIds
|
assert oldLocation in self.zoneId2doIds
|
||||||
assert do.doId in self.zoneId2doIds[oldLocation]
|
assert do.doId in self.zoneId2doIds[oldLocation]
|
||||||
@ -268,9 +273,10 @@ class DoCollectionManager:
|
|||||||
del(self.zoneId2doIds[oldLocation][do.doId])
|
del(self.zoneId2doIds[oldLocation][do.doId])
|
||||||
if len(self.zoneId2doIds[oldLocation]) == 0:
|
if len(self.zoneId2doIds[oldLocation]) == 0:
|
||||||
del self.zoneId2doIds[oldLocation]
|
del self.zoneId2doIds[oldLocation]
|
||||||
# add to new zone
|
if self.isValidLocationTuple(newLocation):
|
||||||
self.zoneId2doIds.setdefault(newLocation, {})
|
# add to new zone
|
||||||
self.zoneId2doIds[newLocation][do.doId]=do
|
self.zoneId2doIds.setdefault(newLocation, {})
|
||||||
|
self.zoneId2doIds[newLocation][do.doId]=do
|
||||||
|
|
||||||
def getObjectsInZone(self, location):
|
def getObjectsInZone(self, location):
|
||||||
""" call this to get a dict of doId:distObj for a zone.
|
""" call this to get a dict of doId:distObj for a zone.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user