I'm glad I could help
BTW, I have made a small change to the code to make it a bit nicer.
In the packet_classes.pas file I have added a cPacketSizeArray Constant.
Code:
Implementation
Const
{..............................................................................}
cPacketSizeArray: Array[TPacketType] Of LongInt =
(
SizeOf(TPacket_Login),
SizeOf(TPacket_Logoff),
SizeOf(TPacket_Chat)
);
{..............................................................................}
{..............................................................................}
and changed the TPacketWriter.WritePacket() method to use this instead of the case statement:
Code:
Function TPacketWriter.WritePacket(Const APacket : PPacket) : Boolean;
Var
DataSize : LongInt;
Begin
Result := False;
DataSize := cPacketSizeArray[APacket^.PacketType];
If Not WriteData(@DataSize,SizeOf(DataSize)) Then Exit;
If Not WriteData(APacket,DataSize) Then Exit;
Result := True;
End;
The code is a bit better now I think :-)
cheers,
Paul
Bookmarks