def ContentList_Request(self, type): if type == const.ContentType['END']: for t in const.ContentType: if t == 'BEGIN' or t == 'END': continue self.ContentList_Request(const.ContentType[t]) return p = DataPacket(0, const.PACKET_CONTENT_CLIENT_INFO_LIST) p.send_uint8(type) p.send_uint32(version.generate_newgrf_version(1,1,0,False,0)) # XXX find better way? self.sendMsg_TCP(p.command, p.data)
def ContentList_Request(self, type): if type == const.ContentType['END']: for t in const.ContentType: if t == 'BEGIN' or t == 'END': continue self.ContentList_Request(const.ContentType[t]) return p = DataPacket(0, const.PACKET_CONTENT_CLIENT_INFO_LIST) p.send_uint8(type) p.send_uint32(version.generate_newgrf_version( 1, 1, 0, False, 0)) # XXX find better way? self.sendMsg_TCP(p.command, p.data)
def ContentList_Request_ids(self, ids): count = len(ids) sent = 0 while count > 0: p_count = min((const.SEND_MTU - const.HEADER_SIZE - 4) / 4, count) p = DataPacket(0, const.PACKET_CONTENT_CLIENT_INFO_ID) p.send_uint16(p_count) for i in range(sent, p_count + sent): p.send_uint32(ids[i]) self.sendMsg_TCP(p.command, p.data) count -= p_count sent += p_count