Changeset 353


Ignore:
Timestamp:
Dec 28, 2024, 10:35:15 PM (21 hours ago)
Author:
chronos
Message:
  • Fixed: Missing units id recalculation before save to file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Units.pas

    r346 r353  
    4141    NewId: Integer;
    4242    Game: TObject; //TGame;
     43    procedure RecalculateItemsId;
    4344    procedure FixRefId;
    4445    function FindById(Id: Integer): TUnit;
     
    5960{ TUnits }
    6061
     62procedure TUnits.RecalculateItemsId;
     63var
     64  I: Integer;
     65begin
     66  for I := 0 to Count - 1 do
     67    Items[I].Id := I + 1;
     68  NewId := Count + 1;
     69end;
     70
    6171procedure TUnits.FixRefId;
    6272var
     
    104114  NewNode2: TDOMNode;
    105115begin
     116  RecalculateItemsId;
    106117  for I := 0 to Count - 1 do
    107118  with Items[I] do begin
Note: See TracChangeset for help on using the changeset viewer.