Hi Loic,
I'm having problems with unpacking packets that inherit from packetlist
(packettablelist and tourneylist)
In a(2).as you wrote:
public class PacketPokerTableList extends Packet
{
public var packets:Array;
public var players:int;
public var tables:int;
public override function unpack():void
{
super.unpack();
// implement packets of type pl
this.players = bytes.readInt();
this.tables = bytes.readInt();
}
}
What I'm not understanding is " //implement packets of type pl ???
Could you perhaps give me a basic conversion to as3 of the following?
def unpack(self, block):
block = Packet.unpack(self, block)
(length,) = unpack(PacketList.format,
block[:PacketList.format_size])
block = block[PacketList.format_size:]
t = Packet()
count = 0
self.packets = []
while len(block) > 0 and count < length:
t.unpack(block)
if not PacketFactory.has_key(t.type):
print " *ERROR* unknown packet type %d (known types are %s)"
% ( t.type, PacketNames)
return
packet = PacketFactory[t.type]()
block = packet.unpack(block)
count += 1
self.packets.append(packet)
if count != length:
print " *ERROR* expected a list of %d packets but found only %d"
% ( length, count)
return block
Thanks,
Michael
_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users