Changeset 336 for trunk/ItemList.pas


Ignore:
Timestamp:
Sep 7, 2024, 10:29:16 PM (2 months ago)
Author:
chronos
Message:
  • Added: Automated tests accessible in debug mode.
  • Fixed: Player units internal links.
  • Fixed: List items id regeneration before game save.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ItemList.pas

    r334 r336  
    7979  private
    8080    procedure RecalculateNewId(Reset: Boolean);
     81    procedure RecalculateItemsId;
    8182  public
    8283    NewId: Integer;
     
    147148  for I := 0 to Count - 1 do
    148149    TItem(Items[I]).Assign(Source.Items[I]);
    149   RecalculateNewId(True);
    150150end;
    151151
     
    176176    Node2 := Node2.NextSibling;
    177177  end;
    178   RecalculateNewId(True);
    179178end;
    180179
     
    184183  NewNode2: TDOMNode;
    185184begin
     185  RecalculateItemsId;
    186186  for I := 0 to Count - 1 do
    187187  with TItem(Items[I]) do begin
     
    207207    NewId := Max(NewId, Id + 1);
    208208  end;
     209end;
     210
     211procedure TItemList.RecalculateItemsId;
     212var
     213  I: Integer;
     214begin
     215  for I := 0 to Count - 1 do
     216    Items[I].Id := I + 1;
     217  NewId := Count + 1;
    209218end;
    210219
Note: See TracChangeset for help on using the changeset viewer.