diff --git a/Client/ULandscape.pas b/Client/ULandscape.pas index 8ed08c2..5db0e9c 100644 --- a/Client/ULandscape.pas +++ b/Client/ULandscape.pas @@ -1198,42 +1198,47 @@ var begin AssignFile(noDrawFile, AFileName); Reset(noDrawFile); - while not EOF(noDrawFile) do - begin - ReadLn(noDrawFile, line); - if (Length(line) > 0) and (line[1] in ['S', 'T']) then + try + while not EOF(noDrawFile) do begin - splitPos := Pos('-', line); - if splitPos > 1 then + ReadLn(noDrawFile, line); + if (Length(line) > 0) and (line[1] in ['S', 'T']) then begin - ids1 := Copy(line, 2, splitPos - 2); - ids2 := Copy(line, splitPos + 1, Length(line)); - if TryStrToInt(ids1, id1) and TryStrToInt(ids2, id2) then + splitPos := Pos('-', line); + if splitPos > 1 then begin - if line[1] = 'S' then + ids1 := Copy(line, 2, splitPos - 2); + ids2 := Copy(line, splitPos + 1, Length(line)); + if TryStrToInt(ids1, id1) and TryStrToInt(ids2, id2) then begin - Inc(id1, $4000); - Inc(id2, $4000); - end; + if line[1] = 'S' then + begin + Inc(id1, $4000); + Inc(id2, $4000); + end; - for i := id1 to id2 do - if i < FDrawMap.Size then - FDrawMap[i] := False; - end; - end else - begin - ids1 := Copy(line, 2, Length(line)); - if TryStrToInt(ids1, id1) then + if id1 < 0 then + id1 := 0; + for i := id1 to id2 do + if i < FDrawMap.Size then + FDrawMap[i] := False; + end; + end else begin - if line[1] = 'S' then - Inc(id1, $4000); - if id1 < FDrawMap.Size then - FDrawMap[id1] := False; + ids1 := Copy(line, 2, Length(line)); + if TryStrToInt(ids1, id1) then + begin + if line[1] = 'S' then + Inc(id1, $4000); + if (id1 >= 0) and (id1 < FDrawMap.Size) then + FDrawMap[id1] := False; + end; end; end; end; + finally + CloseFile(noDrawFile); end; - CloseFile(noDrawFile); end; procedure TLandscape.MoveStatic(AStatic: TStaticItem; AX, AY: Word);