Changeset 336 for trunk/Unit.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/Unit.pas

    r317 r336  
    243243
    244244procedure TUnit.SetPlayer(AValue: TObject);
     245var
     246  OldValue: TPlayer;
    245247begin
    246248  if FPlayer = AValue then Exit;
    247   if Assigned(FPlayer) then TPlayer(FPlayer).Units.Remove(Self);
     249  OldValue := TPlayer(FPlayer);
     250  FPlayer := nil;
     251  if Assigned(OldValue) then TPlayer(OldValue).Units.Remove(Self);
    248252  FPlayer := AValue;
    249253  if Assigned(FPlayer) then TPlayer(FPlayer).Units.Add(Self);
     
    301305destructor TUnit.Destroy;
    302306begin
     307  Player := nil;
    303308  inherited;
    304309end;
Note: See TracChangeset for help on using the changeset viewer.