Changeset 336 for trunk/Unit.pas
- Timestamp:
- Sep 7, 2024, 10:29:16 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Unit.pas
r317 r336 243 243 244 244 procedure TUnit.SetPlayer(AValue: TObject); 245 var 246 OldValue: TPlayer; 245 247 begin 246 248 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); 248 252 FPlayer := AValue; 249 253 if Assigned(FPlayer) then TPlayer(FPlayer).Units.Add(Self); … … 301 305 destructor TUnit.Destroy; 302 306 begin 307 Player := nil; 303 308 inherited; 304 309 end;
Note:
See TracChangeset
for help on using the changeset viewer.