On 2006/09/20, at 12:44, John Hurliman wrote:
Michael Cortez wrote:
ChatFromViewerPacket p = new ChatFromViewerPacket();
p.AgentData.AgentID = myAgentID;
p.AgentData.SessionID = mySessionID;
p.ChatData.Message = "hello, simulator"
p.ChatData.Type = 1;
p.ChatData.Channel = 0;
I'm curious how the packets that have 0=>* fields would work, like
InventoryDescendants.
p.Items[x].Name ?
and if we had to construct such a packet
p.Items = new p.Items[y]; ???
I think that looks good, the only suggestion I would have is that
blocks that have more than one instance but a known quantity (like
"Multiple 4") could be initialized in the pre-generated constructor
like NeighborBlock = new NeighborBlockBlock[4]; whereas variable
blocks are either left null (and the ToBytes functions can handle
null) or initialized like FolderData = new FolderDataBlock[0]; and
the client app can reinitialize to the size it wishes before sending.
This is how I'm doing it now. Variable blocks are an array of
blocks, initialized to null. Multiple blocks are an array of blocks,
pre-initialized. Variable fields and fixed fields are both byte
arrays, initialized to null.
So for example, if you were making a PacketAck:
PacketAckPacket p = new PacketAckPacket();
p.Packets = new PacketAckPacket.PacketsBlock[2];
p.Packets[0].ID = 23;
p.Packets[1].ID = 42;
I may (or may not) add some convenience functions that set the blocks
up for you, but the underlying implementation is arrays.
_______________________________________________
libsecondlife-dev mailing list
libsecondlife-dev@gna.org
https://mail.gna.org/listinfo/libsecondlife-dev
http://www.libsecondlife.org/