- Added more checks to statics loading and saving and replaced unnecessary LongInt casts
This commit is contained in:
parent
114c218ca6
commit
7e86c7400c
|
@ -479,14 +479,14 @@ begin
|
||||||
FStaIdx.Position := ((AWorldBlock.X * FHeight) + AWorldBlock.Y) * 12;
|
FStaIdx.Position := ((AWorldBlock.X * FHeight) + AWorldBlock.Y) * 12;
|
||||||
index := TGenericIndex.Create(FStaIdx);
|
index := TGenericIndex.Create(FStaIdx);
|
||||||
size := AWorldBlock.GetSize;
|
size := AWorldBlock.GetSize;
|
||||||
if (size > index.Size) or (index.Lookup = LongInt($FFFFFFFF)) then
|
if (size > index.Size) or (index.Lookup < 0) then
|
||||||
begin
|
begin
|
||||||
FStatics.Position := FStatics.Size;
|
FStatics.Position := FStatics.Size;
|
||||||
index.Lookup := FStatics.Position;
|
index.Lookup := FStatics.Position;
|
||||||
end;
|
end;
|
||||||
index.Size := size;
|
index.Size := size;
|
||||||
if size = 0 then
|
if size = 0 then
|
||||||
index.Lookup := LongInt($FFFFFFFF)
|
index.Lookup := -1
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FStatics.Position := index.Lookup;
|
FStatics.Position := index.Lookup;
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<PathDelim Value="/"/>
|
<Version Value="7"/>
|
||||||
<Version Value="6"/>
|
|
||||||
<General>
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<LRSInOutputDirectory Value="False"/>
|
||||||
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<IconPath Value="./"/>
|
|
||||||
<TargetFileExt Value=".exe"/>
|
<TargetFileExt Value=".exe"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
|
|
|
@ -165,7 +165,7 @@ begin
|
||||||
FY := AY;
|
FY := AY;
|
||||||
|
|
||||||
FItems := TList.Create;
|
FItems := TList.Create;
|
||||||
if assigned(AData) and (AIndex.Lookup <> LongInt($FFFFFFFF)) then
|
if assigned(AData) and (AIndex.Lookup > 0) and (AIndex.Size > 0) then
|
||||||
begin
|
begin
|
||||||
AData.Position := AIndex.Lookup;
|
AData.Position := AIndex.Lookup;
|
||||||
block := TMemoryStream.Create;
|
block := TMemoryStream.Create;
|
||||||
|
@ -219,9 +219,7 @@ var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
for i := 0 to FItems.Count - 1 do
|
for i := 0 to FItems.Count - 1 do
|
||||||
begin
|
|
||||||
TStaticItem(FItems[i]).Write(AData);
|
TStaticItem(FItems[i]).Write(AData);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TStaticBlock.ReverseWrite(AData: TStream);
|
procedure TStaticBlock.ReverseWrite(AData: TStream);
|
||||||
|
@ -297,7 +295,7 @@ begin
|
||||||
for i := 0 to 63 do
|
for i := 0 to 63 do
|
||||||
Cells[i] := TList.Create;
|
Cells[i] := TList.Create;
|
||||||
|
|
||||||
if (AData <> nil) and (AIndex.Lookup <> LongInt($FFFFFFFF)) then
|
if (AData <> nil) and (AIndex.Lookup > 0) and (AIndex.Size > 0) then
|
||||||
begin
|
begin
|
||||||
AData.Position := AIndex.Lookup;
|
AData.Position := AIndex.Lookup;
|
||||||
block := TMemoryStream.Create;
|
block := TMemoryStream.Create;
|
||||||
|
|
Loading…
Reference in New Issue