🐛 Accept empty tile filters in large scale operations
An empty tile list is a valid no-filter request, but the constructors dereferenced the empty array while reading it.
This commit is contained in:
@@ -255,7 +255,8 @@ begin
|
|||||||
inherited Init(AData, ALandscape);
|
inherited Init(AData, ALandscape);
|
||||||
count := AData.ReadWord;
|
count := AData.ReadWord;
|
||||||
SetLength(FTileIDs, count);
|
SetLength(FTileIDs, count);
|
||||||
AData.Read(FTileIDs[0], count * SizeOf(Word));
|
if count > 0 then
|
||||||
|
AData.Read(FTileIDs[0], count * SizeOf(Word));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLSDrawTerrain.Apply(AMapCell: TMapCell; AStatics: TStaticItemList;
|
procedure TLSDrawTerrain.Apply(AMapCell: TMapCell; AStatics: TStaticItemList;
|
||||||
@@ -275,7 +276,8 @@ begin
|
|||||||
inherited Init(AData, ALandscape);
|
inherited Init(AData, ALandscape);
|
||||||
count := AData.ReadWord;
|
count := AData.ReadWord;
|
||||||
SetLength(FTileIDs, count);
|
SetLength(FTileIDs, count);
|
||||||
AData.Read(FTileIDs[0], count * SizeOf(Word));
|
if count > 0 then
|
||||||
|
AData.Read(FTileIDs[0], count * SizeOf(Word));
|
||||||
FMinZ := AData.ReadShortInt;
|
FMinZ := AData.ReadShortInt;
|
||||||
FMaxZ := AData.ReadShortInt;
|
FMaxZ := AData.ReadShortInt;
|
||||||
end;
|
end;
|
||||||
@@ -325,7 +327,8 @@ begin
|
|||||||
inherited Init(AData, ALandscape);
|
inherited Init(AData, ALandscape);
|
||||||
count := AData.ReadWord;
|
count := AData.ReadWord;
|
||||||
SetLength(FTileIDs, count);
|
SetLength(FTileIDs, count);
|
||||||
AData.Read(FTileIDs[0], count * SizeOf(Word));
|
if count > 0 then
|
||||||
|
AData.Read(FTileIDs[0], count * SizeOf(Word));
|
||||||
FProbability := AData.ReadByte;
|
FProbability := AData.ReadByte;
|
||||||
FPlacementType := TStaticsPlacement(AData.ReadByte);
|
FPlacementType := TStaticsPlacement(AData.ReadByte);
|
||||||
if FPlacementType = spFix then
|
if FPlacementType = spFix then
|
||||||
|
|||||||
Reference in New Issue
Block a user