- Fixed memory leak in TfrmFilter (not freeing FCheckedHues)
- Fixed memory leak in TfrmMain (not freeing the strings in the location info nodes) - Rearranged frmEditAccount to allow region handling - Added region handling to the client side account specific network packets - Fixed some more code style inconsistencies in UfrmRegionControl.pas - Fixed redrawing in TfrmRegionControl - Fixed memory leak in TAccount (not freeing FRegions) - Fixed the TModifyRegionResponsePacket ID - Fixed the content of the TUserListPacket to not contain the list of all regions
This commit is contained in:
@@ -32,7 +32,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, md5, contnrs, math, DOM, UXmlHelper, UInterfaces,
|
||||
UEnums, URegions;
|
||||
|
||||
|
||||
type
|
||||
|
||||
{ TAccount }
|
||||
@@ -41,6 +41,7 @@ type
|
||||
constructor Create(AOwner: IInvalidate; AName, APasswordHash: string;
|
||||
AAccessLevel: TAccessLevel; ARegions: TStringList);
|
||||
constructor Deserialize(AOwner: IInvalidate; AElement: TDOMElement);
|
||||
destructor Destroy; override;
|
||||
procedure Serialize(AElement: TDOMElement);
|
||||
protected
|
||||
FOwner: IInvalidate;
|
||||
@@ -60,7 +61,7 @@ type
|
||||
property Regions: TStringList read FRegions;
|
||||
procedure Invalidate;
|
||||
end;
|
||||
|
||||
|
||||
{ TAccountList }
|
||||
|
||||
TAccountList = class(TObjectList, ISerializable, IInvalidate)
|
||||
@@ -113,7 +114,7 @@ begin
|
||||
FLastPos := Point(0, 0);
|
||||
TXmlHelper.ReadCoords(AElement, 'LastPos', FLastPos.X, FLastPos.Y);
|
||||
FRegions := TStringList.Create;
|
||||
|
||||
|
||||
xmlElement := TDOMElement(AElement.FindNode('Regions'));
|
||||
if xmlElement <> nil then
|
||||
begin
|
||||
@@ -131,6 +132,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TAccount.Destroy;
|
||||
begin
|
||||
if FRegions <> nil then FreeAndNil(FRegions);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TAccount.SetAccessLevel(const AValue: TAccessLevel);
|
||||
begin
|
||||
FAccessLevel := AValue;
|
||||
@@ -157,8 +164,8 @@ end;
|
||||
|
||||
procedure TAccount.Serialize(AElement: TDOMElement);
|
||||
var
|
||||
i : Integer;
|
||||
child : TDOMElement;
|
||||
i: Integer;
|
||||
child: TDOMElement;
|
||||
begin
|
||||
TXmlHelper.WriteString(AElement, 'Name', FName);
|
||||
TXmlHelper.WriteString(AElement, 'PasswordHash', FPasswordHash);
|
||||
|
||||
@@ -32,7 +32,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, math, UPacket, UPacketHandlers, UConfig, UAccount,
|
||||
UNetState, UEnhancedMemoryStream, UEnums, URegions;
|
||||
|
||||
|
||||
type
|
||||
|
||||
{ TModifyUserResponsePacket }
|
||||
@@ -40,13 +40,13 @@ type
|
||||
TModifyUserResponsePacket = class(TPacket)
|
||||
constructor Create(AStatus: TModifyUserStatus; AAccount: TAccount);
|
||||
end;
|
||||
|
||||
|
||||
{ TDeleteUserResponsePacket }
|
||||
|
||||
TDeleteUserResponsePacket = class(TPacket)
|
||||
constructor Create(AStatus: TDeleteUserStatus; AUsername: string);
|
||||
end;
|
||||
|
||||
|
||||
{ TUserListPacket }
|
||||
|
||||
TUserListPacket = class(TPacket)
|
||||
@@ -64,13 +64,13 @@ type
|
||||
TDeleteRegionResponsePacket = class(TPacket)
|
||||
constructor Create(AStatus: TDeleteRegionStatus; ARegionName: string);
|
||||
end;
|
||||
|
||||
|
||||
{ TUserRegionsPacket }
|
||||
|
||||
TRegionListPacket = class(TPacket)
|
||||
constructor Create;
|
||||
end;
|
||||
|
||||
|
||||
procedure OnAdminHandlerPacket(ABuffer: TEnhancedMemoryStream; ANetState: TNetState);
|
||||
procedure OnFlushPacket(ABuffer: TEnhancedMemoryStream; ANetState: TNetState);
|
||||
procedure OnQuitPacket(ABuffer: TEnhancedMemoryStream; ANetState: TNetState);
|
||||
@@ -302,10 +302,8 @@ begin
|
||||
begin
|
||||
FStream.WriteByte(Byte(AAccount.AccessLevel));
|
||||
FStream.WriteByte(AAccount.Regions.Count);
|
||||
if AAccount.Regions.Count > 0 then begin
|
||||
for i := 0 to AAccount.Regions.Count - 1 do
|
||||
FStream.WriteStringNull(AAccount.Regions[i]);
|
||||
end;
|
||||
for i := 0 to AAccount.Regions.Count - 1 do
|
||||
FStream.WriteStringNull(AAccount.Regions[i]);
|
||||
end;
|
||||
{TODO : check for client side modifications!}
|
||||
end;
|
||||
@@ -339,9 +337,6 @@ begin
|
||||
for j := 0 to account.Regions.Count - 1 do
|
||||
FStream.WriteStringNull(account.Regions[j]);
|
||||
end;
|
||||
FStream.WriteWord(Config.Regions.Count);
|
||||
for i := 0 to Config.Regions.Count - 1 do
|
||||
FStream.WriteStringNull(TRegion(Config.Regions.Items[i]).Name);
|
||||
end;
|
||||
|
||||
{ TModifyRegionResponsePacket }
|
||||
@@ -389,7 +384,7 @@ var
|
||||
region: TRegion;
|
||||
begin
|
||||
inherited Create($03, 0);
|
||||
FStream.WriteByte($08);
|
||||
FStream.WriteByte($0A);
|
||||
FStream.WriteByte(Config.Regions.Count);
|
||||
for i := 0 to Config.Regions.Count - 1 do
|
||||
begin
|
||||
|
||||
Reference in New Issue
Block a user