Changeset 274 for trunk/UGameSystem.pas
- Timestamp:
- Feb 3, 2019, 8:32:20 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGameSystem.pas
r265 r274 6 6 7 7 uses 8 Classes, SysUtils, fgl, UUnit, DOM, UXMLUtils ;8 Classes, SysUtils, fgl, UUnit, DOM, UXMLUtils, XMLConf; 9 9 10 10 type … … 15 15 TGameSystem = class 16 16 Name: string; 17 ActionExecutionPhase: TActionExecutionPhase;18 17 MaxPlayerCount: Integer; 19 18 UnitKinds: TUnitKinds; 20 CanSplitMerge: Boolean;19 UnitsSplitMerge: Boolean; 21 20 EmptyCellsNeutral: Boolean; 21 UnitsMoveImmediately: Boolean; 22 22 constructor Create; 23 23 destructor Destroy; override; … … 27 27 procedure LoadFromFile(FileName: string); 28 28 procedure SaveToFile(FileName: string); 29 procedure LoadConfig(Config: TXmlConfig; Path: string); 30 procedure SaveConfig(Config: TXmlConfig; Path: string); 29 31 end; 30 32 … … 62 64 begin 63 65 Name := Source.Name; 66 UnitsMoveImmediately := Source.UnitsMoveImmediately; 64 67 MaxPlayerCount := Source.MaxPlayerCount; 65 CanSplitMerge := Source.CanSplitMerge;68 UnitsSplitMerge := Source.UnitsSplitMerge; 66 69 EmptyCellsNeutral := Source.EmptyCellsNeutral; 67 70 end; … … 72 75 begin 73 76 Name := ReadString(Node, 'Name', ''); 74 CanSplitMerge := ReadBoolean(Node, 'CanSplitMerge', False);77 UnitsSplitMerge := ReadBoolean(Node, 'UnitsSplitMerge', False); 75 78 EmptyCellsNeutral := ReadBoolean(Node, 'EmptyCellsNeutral', False); 79 UnitsMoveImmediately := ReadBoolean(Node, 'UnitsMoveImmediately', False); 76 80 77 81 NewNode := Node.FindNode('UnitKinds'); … … 85 89 begin 86 90 WriteString(Node, 'Name', Name); 87 WriteBoolean(Node, ' CanSplitMerge', CanSplitMerge);91 WriteBoolean(Node, 'UnitsSplitMerge', UnitsSplitMerge); 88 92 WriteBoolean(Node, 'EmptyCellsNeutral', EmptyCellsNeutral); 93 WriteBoolean(Node, 'UnitsMoveImmediately', UnitsMoveImmediately); 89 94 90 95 NewNode := Node.OwnerDocument.CreateElement('UnitKinds'); … … 103 108 end; 104 109 110 procedure TGameSystem.LoadConfig(Config: TXmlConfig; Path: string); 111 begin 112 with Config do begin 113 Self.Name := string(GetValue(DOMString(Path + '/Name'), DOMString(''))); 114 UnitsSplitMerge := GetValue(DOMString(Path + '/UnitsSplitMerge'), True); 115 EmptyCellsNeutral := GetValue(DOMString(Path + '/EmptyCellsNeutral'), False); 116 UnitsMoveImmediately := GetValue(DOMString(Path + '/UnitsMoveImmediately'), False); 117 end; 118 end; 119 120 procedure TGameSystem.SaveConfig(Config: TXmlConfig; Path: string); 121 begin 122 with Config do begin 123 SetValue(DOMString(Path + '/Name'), DOMString(Self.Name)); 124 SetValue(DOMString(Path + '/UnitsSplitMerge'), UnitsSplitMerge); 125 SetValue(DOMString(Path + '/EmptyCellsNeutral'), EmptyCellsNeutral); 126 SetValue(DOMString(Path + '/UnitsMoveImmediately'), UnitsMoveImmediately); 127 end; 128 end; 129 105 130 end. 106 131
Note:
See TracChangeset
for help on using the changeset viewer.