- Added generic tiledata access to TTileDataProvider (to avoid cloning)
- Fixed TfrmMain.BuildTileList to use that non-cloning tiledata access to remove a memory leak - Convert the filter text to ISO8859-1 first
This commit is contained in:
parent
34765f7235
commit
908bddda07
|
@ -2297,7 +2297,7 @@ var
|
||||||
begin
|
begin
|
||||||
if cbTerrain.Checked then minID := $0 else minID := $4000;
|
if cbTerrain.Checked then minID := $0 else minID := $4000;
|
||||||
if cbStatics.Checked then maxID := $7FFF else maxID := $3FFF;
|
if cbStatics.Checked then maxID := $7FFF else maxID := $3FFF;
|
||||||
filter := AnsiLowerCase(edFilter.Text);
|
filter := AnsiLowerCase(UTF8ToISO_8859_1(edFilter.Text));
|
||||||
|
|
||||||
node := vdtTiles.GetFirstSelected;
|
node := vdtTiles.GetFirstSelected;
|
||||||
if node <> nil then
|
if node <> nil then
|
||||||
|
@ -2314,8 +2314,8 @@ begin
|
||||||
begin
|
begin
|
||||||
if ResMan.Art.Exists(i) then
|
if ResMan.Art.Exists(i) then
|
||||||
begin
|
begin
|
||||||
if (filter <> '') and (Pos(filter, AnsiLowerCase(TTileData(
|
if (filter <> '') and (Pos(filter, AnsiLowerCase(
|
||||||
ResMan.Tiledata.Block[i]).TileName)) = 0) then Continue;
|
ResMan.Tiledata.TileData[i].TileName)) = 0) then Continue;
|
||||||
node := vdtTiles.AddChild(nil);
|
node := vdtTiles.AddChild(nil);
|
||||||
tileInfo := vdtTiles.GetNodeData(node);
|
tileInfo := vdtTiles.GetNodeData(node);
|
||||||
tileInfo^.ID := i;
|
tileInfo^.ID := i;
|
||||||
|
|
|
@ -35,6 +35,9 @@ uses
|
||||||
type
|
type
|
||||||
TLandTileDataArray = array[$0..$3FFF] of TLandTileData;
|
TLandTileDataArray = array[$0..$3FFF] of TLandTileData;
|
||||||
TStaticTileDataArray = array[$0..$3FFF] of TStaticTileData;
|
TStaticTileDataArray = array[$0..$3FFF] of TStaticTileData;
|
||||||
|
|
||||||
|
{ TTiledataProvider }
|
||||||
|
|
||||||
TTiledataProvider = class(TMulProvider)
|
TTiledataProvider = class(TMulProvider)
|
||||||
constructor Create(AData: TStream; AReadOnly: Boolean = False); overload; override;
|
constructor Create(AData: TStream; AReadOnly: Boolean = False); overload; override;
|
||||||
constructor Create(AData: string; AReadOnly: Boolean = False); overload; override;
|
constructor Create(AData: string; AReadOnly: Boolean = False); overload; override;
|
||||||
|
@ -46,10 +49,12 @@ type
|
||||||
function CalculateOffset(AID: Integer): Integer; override;
|
function CalculateOffset(AID: Integer): Integer; override;
|
||||||
function GetData(AID, AOffset: Integer): TMulBlock; override;
|
function GetData(AID, AOffset: Integer): TMulBlock; override;
|
||||||
procedure SetData(AID, AOffset: Integer; ABlock: TMulBlock); override;
|
procedure SetData(AID, AOffset: Integer; ABlock: TMulBlock); override;
|
||||||
|
function GetTileData(AID: Integer): TTiledata;
|
||||||
public
|
public
|
||||||
function GetBlock(AID: Integer): TMulBlock; override;
|
function GetBlock(AID: Integer): TMulBlock; override;
|
||||||
property LandTiles: TLandTileDataArray read FLandTiles;
|
property LandTiles: TLandTileDataArray read FLandTiles;
|
||||||
property StaticTiles: TStaticTileDataArray read FStaticTiles;
|
property StaticTiles: TStaticTileDataArray read FStaticTiles;
|
||||||
|
property TileData[AID: Integer]: TTiledata read GetTileData; //all tiles, no cloning
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
@ -139,5 +144,13 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TTiledataProvider.GetTileData(AID: Integer): TTiledata;
|
||||||
|
begin
|
||||||
|
if AID < $4000 then
|
||||||
|
Result := FLandTiles[AID]
|
||||||
|
else
|
||||||
|
Result := FStaticTiles[AID - $4000];
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue