Changeset 304 for trunk/UGame.pas
- Timestamp:
- Aug 11, 2019, 4:53:05 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r301 r304 37 37 TGame = class 38 38 private 39 FGameSystem: TGameSystem;40 39 FMapType: TMapType; 41 40 FOnChange: TNotifyEvent; … … 49 48 ProbabilityMatrix: array of array of Single; 50 49 procedure RecordTurnStats; 51 procedure SetGameSystem(AValue: TGameSystem);52 50 procedure SetMapType(AValue: TMapType); 53 51 procedure SetRunning(AValue: Boolean); … … 61 59 procedure WinObjectiveMapPrepare; 62 60 public 61 GameSystem: TGameSystem; 63 62 FileName: string; 64 63 DevelMode: Boolean; … … 87 86 StoredRandSeed: Cardinal; 88 87 GeneratePlayers: Boolean; 89 GameSystemName: string;90 88 procedure PostConfig; 91 89 procedure Assign(Source: TGame); … … 105 103 property Running: Boolean read FRunning write SetRunning; 106 104 property MapType: TMapType read FMapType write SetMapType; 107 property GameSystem: TGameSystem read FGameSystem write SetGameSystem;108 105 published 109 106 property OnMoveUpdated: TMoveUpdatedEvent read FOnMoveUpdated write FOnMoveUpdated; … … 504 501 BridgeEnabled := Source.BridgeEnabled; 505 502 MaxPower := Source.MaxPower; 506 GameSystem := Source.GameSystem;503 GameSystem.Assign(Source.GameSystem); 507 504 end; 508 505 … … 532 529 SetValue(DOMString(Path + '/MaxPower'), MaxPower); 533 530 Players.SaveConfig(Config, Path + '/Players'); 534 SetValue(DOMString(Path + '/GameSystemName'), DOMString(GameSystem Name));531 SetValue(DOMString(Path + '/GameSystemName'), DOMString(GameSystem.GetName)); 535 532 end; 536 533 end; … … 733 730 end; 734 731 735 procedure TGame.SetGameSystem(AValue: TGameSystem);736 begin737 if FGameSystem = AValue then Exit;738 FGameSystem := AValue;739 if Assigned(FGameSystem) then GameSystemName := FGameSystem.GetName740 else GameSystemName := '';741 end;742 743 732 procedure TGame.NextPlayer; 744 733 var … … 860 849 constructor TGame.Create; 861 850 begin 851 GameSystem := TGameSystem.Create; 862 852 Units := TUnits.Create; 863 853 Units.Game := Self; … … 889 879 FreeAndNil(Buildings); 890 880 FreeAndNil(Units); 881 FreeAndNil(GameSystem); 891 882 inherited Destroy; 892 883 end;
Note:
See TracChangeset
for help on using the changeset viewer.