def getPlayerByIndex(self, index): # dep: this uses a cache so that all references to a certain player # index will always yield the same object, which is useful because you # can then test them for object equality valid = host.pmgr_isIndexValid(index) if not valid: if self._pcache.has_key(index): print "Removed player index %d from player cache" % index del self._pcache[index] return None if not self._pcache.has_key(index): self._pcache[index] = Player(index) return self._pcache[index]
def getPlayerByIndex(self, index): # dep: this uses a cache so that all references to a certain player # index will always yield the same object, which is useful because you # can then test them for object equality valid = host.pmgr_isIndexValid(index) if not valid: if self._pcache.has_key(index): if g_debug: print "Removed player index %d from player cache" % index del self._pcache[index] return None if not self._pcache.has_key(index): self._pcache[index] = Player(index) return self._pcache[index]
def isValid(self): return host.pmgr_isIndexValid(self.index)
def isValid(self): return host.pmgr_isIndexValid(self.index) def isRemote(self): return host.pmgr_p_get("remote", self.index)