Changeset 285 for trunk/UPlayer.pas
- Timestamp:
- Mar 10, 2019, 11:57:03 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UPlayer.pas
r284 r285 7 7 uses 8 8 Classes, SysUtils, Graphics, UMap, DOM, fgl, XMLConf, UXMLUtils, Math, 9 UGeometry, UUnit, UNation ;9 UGeometry, UUnit, UNation, UItemList; 10 10 11 11 type … … 92 92 { TPlayer } 93 93 94 TPlayer = class 94 TPlayer = class(TItem) 95 95 private 96 96 FGame: TObject; //TGame; … … 104 104 procedure SetMode(AValue: TPlayerMode); 105 105 public 106 Id: Integer;107 Name: string;108 106 Color: TColor; 109 107 TotalUnits: Integer; … … 121 119 Units: TUnits; 122 120 Nation: TNation; 121 function GetFields: TItemFields; override; 122 procedure GetValue(Index: Integer; out Value); override; 123 procedure SetValue(Index: Integer; var Value); override; 124 class function GetClassSysName: string; override; 123 125 function IsAllowedMoveTarget(CellFrom, CellTo: TPlayerCell): Boolean; 124 126 procedure ReduceMovesPower; … … 135 137 function IsAlive: Boolean; 136 138 procedure Clear; 137 procedure LoadFromNode(Node: TDOMNode); 138 procedure SaveToNode(Node: TDOMNode); 139 procedure LoadFromNode(Node: TDOMNode); override; 140 procedure SaveToNode(Node: TDOMNode); override; 139 141 constructor Create; 140 142 destructor Destroy; override; 141 procedure Assign(Source: T Player);143 procedure Assign(Source: TItem); override; 142 144 procedure LoadConfig(Config: TXmlConfig; Path: string); 143 145 procedure SaveConfig(Config: TXmlConfig; Path: string); … … 880 882 end; 881 883 882 procedure TPlayer.Assign(Source: T Player);884 procedure TPlayer.Assign(Source: TItem); 883 885 begin 884 886 Id := Source.Id; 885 887 Name := Source.Name; 886 Color := Source.Color;887 Mode := Source.Mode;888 Game := Source.Game;889 TotalCells := Source.TotalCells;890 TotalUnits := Source.TotalUnits;891 TotalCities := Source.TotalCities;892 TotalDiscovered := Source.TotalDiscovered;893 TotalWinObjectiveCells := Source.TotalWinObjectiveCells;894 StartUnits := Source.StartUnits;895 StartCell := Source.StartCell;896 Agressivity := Source.Agressivity;897 Defensive := Source.Defensive;898 Nation := Source.Nation;888 Color := TPlayer(Source).Color; 889 Mode := TPlayer(Source).Mode; 890 Game := TPlayer(Source).Game; 891 TotalCells := TPlayer(Source).TotalCells; 892 TotalUnits := TPlayer(Source).TotalUnits; 893 TotalCities := TPlayer(Source).TotalCities; 894 TotalDiscovered := TPlayer(Source).TotalDiscovered; 895 TotalWinObjectiveCells := TPlayer(Source).TotalWinObjectiveCells; 896 StartUnits := TPlayer(Source).StartUnits; 897 StartCell := TPlayer(Source).StartCell; 898 Agressivity := TPlayer(Source).Agressivity; 899 Defensive := TPlayer(Source).Defensive; 900 Nation := TPlayer(Source).Nation; 899 901 end; 900 902 … … 1261 1263 if FMode = AValue then Exit; 1262 1264 FMode := AValue; 1265 end; 1266 1267 function TPlayer.GetFields: TItemFields; 1268 begin 1269 Result := inherited; 1270 Result.AddField(2, 'Color', 'Color', dtColor); 1271 Result.AddField(3, 'Mode', 'Mode', dtInteger); 1272 Result.AddField(4, 'StartUnits', 'StartUnits', dtInteger); 1273 Result.AddField(5, 'Agressivity', 'Agressivity', dtInteger); 1274 Result.AddField(6, 'Defensive', 'Defensive', dtBoolean); 1275 end; 1276 1277 procedure TPlayer.GetValue(Index: Integer; out Value); 1278 begin 1279 inherited GetValue(Index, Value); 1280 end; 1281 1282 procedure TPlayer.SetValue(Index: Integer; var Value); 1283 begin 1284 inherited SetValue(Index, Value); 1285 end; 1286 1287 class function TPlayer.GetClassSysName: string; 1288 begin 1289 Result := 'Player'; 1263 1290 end; 1264 1291
Note:
See TracChangeset
for help on using the changeset viewer.