Changeset 336 for trunk/Player.pas


Ignore:
Timestamp:
Sep 7, 2024, 10:29:16 PM (11 days 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/Player.pas

    r335 r336  
    776776begin
    777777  inherited;
    778   WriteInteger(Node, 'StartCell', StartCell.Id);
     778  if Assigned(StartCell) then
     779    WriteInteger(Node, 'StartCell', StartCell.Id);
    779780
    780781  with Node do begin
     
    809810
    810811destructor TPlayer.Destroy;
     812var
     813  I: Integer;
    811814begin
    812815  //Client := nil;
     
    814817  FreeAndNil(PlayerMap);
    815818  FreeAndNil(Moves);
     819  for I := Units.Count - 1 downto 0 do
     820    Units[I].Player := nil;
    816821  FreeAndNil(Units);
    817822  inherited;
     
    828833  TotalWinObjectiveCells := TPlayer(Source).TotalWinObjectiveCells;
    829834  StartCell := TPlayer(Source).StartCell;
     835  Color := TPlayer(Source).Color;
     836  //Units.Assign(TPlayer(Source).Units);
     837  Nation := TPlayer(Source).Nation;
    830838end;
    831839
     
    978986  // Clean from cell from empty units
    979987  if UnitMove.CellFrom.MapCell.OneUnit.Power = 0 then begin
    980     Units.Remove(UnitMove.CellFrom.MapCell.OneUnit);
     988    UnitMove.CellFrom.MapCell.OneUnit.Player := nil;
    981989    UnitMove.CellFrom.MapCell.OneUnit := nil;
    982990  end;
     
    10361044      OneUnit := MapCell.OneUnit;
    10371045      MapCell.OneUnit := nil;
    1038       Units.Remove(OneUnit);
     1046      OneUnit.Player := nil;
    10391047    end;
    10401048  end;
     
    12861294        NewUnit.Player := Self;
    12871295        NewUnit.MapCell := Cells[I];
    1288         Units.Add(NewUnit);
    12891296      end;
    12901297      if OneUnit.Power < MaxPower then begin
Note: See TracChangeset for help on using the changeset viewer.