var
i: Integer;
begin
- for i := 0 to FBoardList.Count - 1 do begin
+ for i := FBoardList.Count - 1 downto 0 do begin
if FBoardList[i] <> nil then
TRoundItem(FBoardList[i]).Free;
FBoardList.Delete(i);
end;
- for i := 0 to FItemList.Count - 1 do begin
+ for i := FItemList.Count - 1 downto 0 do begin
if FItemList[i] <> nil then
TRoundItem(FItemList[i]).Free;
FItemList.Delete(i);
Item: TRoundItem;
begin
Result := -1;
- for i := 0 to FItemList.Count - 1 do begin
- Item := TRoundItem(FItemList[i]);
- if Item.FRoundType <> RoundType then Continue;
- if Item.FURL = URL then begin
- Result := i;
- Exit;
+ if RoundType = grtItem then begin
+ for i := 0 to FItemList.Count - 1 do begin
+ Item := TRoundItem(FItemList[i]);
+ if Item.FRoundType <> RoundType then Continue;
+ if Item.FURL = URL then begin
+ Result := i;
+ Exit;
+ end;
end;
- end;
+ end else begin
+ for i := 0 to FBoardList.Count - 1 do begin
+ Item := TRoundItem(FBoardList[i]);
+ if Item.FRoundType <> RoundType then Continue;
+ if Item.FURL = URL then begin
+ Result := i;
+ Exit;
+ end;
+ end;
+ end;
end;
procedure TRoundList.Delete(URL: string; RoundType: TGikoRoundType);
var
begin
idx := Find(URL, RoundType);
if idx <> -1 then begin
- Item := TRoundItem(FItemList[idx]);
- Item.Free;
- FItemList.Delete(idx);
+
if RoundType = grtBoard then begin
+ Item := TRoundItem(FBoardList[idx]);
+ Item.Free;
+ FBoardList.Delete(idx);
board := BBSsFindBoardFromURL(URL);
- board.Round := False;
- board.RoundName := '';
+ if board <> nil then begin
+ board.Round := False;
+ board.RoundName := '';
+ end;
end else begin
+ Item := TRoundItem(FItemList[idx]);
+ Item.Free;
+ FItemList.Delete(idx);
+
threadItem := BBSsFindThreadFromURL(URL);
- threadItem.Round := false;
- threadItem.RoundName := '';
+ if threadItem <> nil then begin
+ threadItem.Round := false;
+ threadItem.RoundName := '';
+ end;
end;
end;
end;