Changeset 70 for trunk/UGame.pas
- Timestamp:
- Sep 28, 2014, 6:04:57 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r69 r70 190 190 TotalCities: Integer; 191 191 StartUnits: Integer; 192 StartCell: TCell; 192 193 procedure LoadFromNode(Node: TDOMNode); 193 194 procedure SaveToNode(Node: TDOMNode); … … 278 279 VoidEnabled: Boolean; 279 280 VoidPercentage: Integer; 281 SymetricMap: Boolean; 280 282 GrowCells: TGrowCells; 281 283 GrowAmount: TGrowAmount; … … 291 293 FileName: string; 292 294 function AttackProbability(AttackCount, DefendCount, Depth: Integer): Double; 295 procedure LoadConfig(Config: TXmlConfig; Path: string); 293 296 procedure SaveConfig(Config: TXmlConfig; Path: string); 294 procedure LoadConfig(Config: TXmlConfig; Path: string);295 297 procedure LoadFromFile(FileName: string); 296 298 procedure SaveToFile(FileName: string); … … 1400 1402 View := TView.Create; 1401 1403 StartUnits := DefaultPlayerStartUnits; 1404 StartCell := nil; 1402 1405 end; 1403 1406 … … 1417 1420 TotalUnits := Source.TotalUnits; 1418 1421 StartUnits := Source.StartUnits; 1422 StartCell := Source.StartCell; 1419 1423 View.Assign(Source.View); 1420 1424 end; … … 1431 1435 AttackerDiceCount: Integer; 1432 1436 DefenderDiceCount: Integer; 1433 AttackerHighestRoll: Integer;1434 DefenderHighestRoll: Integer;1435 RollResult: Integer;1436 1437 S: string; 1437 1438 I: Integer; … … 1686 1687 with Config do begin 1687 1688 SetValue(Path + '/GridType', Integer(MapType)); 1689 SetValue(Path + '/SymetricMap', SymetricMap); 1688 1690 SetValue(Path + '/VoidEnabled', VoidEnabled); 1689 1691 SetValue(Path + '/VoidPercentage', VoidPercentage); … … 1704 1706 with Config do begin 1705 1707 MapType := TMapType(GetValue(Path + '/GridType', Integer(mtHexagon))); 1708 SymetricMap := GetValue(Path + '/SymetricMap', False); 1706 1709 VoidEnabled := GetValue(Path + '/VoidEnabled', True); 1707 1710 VoidPercentage := GetValue(Path + '/VoidPercentage', 20); … … 1731 1734 RootNode := Doc.DocumentElement; 1732 1735 with RootNode do begin 1736 SymetricMap := ReadBoolean(RootNode, 'SymetricMap', False); 1733 1737 VoidEnabled := ReadBoolean(RootNode, 'VoidEnabled', False); 1734 1738 VoidPercentage := ReadInteger(RootNode, 'VoidPercentage', 0); … … 1773 1777 AppendChild(RootNode); 1774 1778 with RootNode do begin 1779 WriteBoolean(RootNode, 'SymetricMap', SymetricMap); 1775 1780 WriteBoolean(RootNode, 'VoidEnabled', VoidEnabled); 1776 1781 WriteInteger(RootNode, 'VoidPercentage', VoidPercentage); … … 1934 1939 procedure TGame.New; 1935 1940 var 1936 X, Y: Integer;1937 NewCell: TCell;1938 1941 I: Integer; 1939 1942 StartCell: TCell; … … 1956 1959 Player := nil; 1957 1960 end; 1961 1962 if SymetricMap then begin 1963 for C := 0 to Map.Cells.Count div 2 - 1 do begin 1964 TCell(Map.Cells[C]).Terrain := 1965 TCell(Map.Cells[Map.Cells.Count - 1 - C]).Terrain; 1966 TCell(Map.Cells[C]).Power := 1967 TCell(Map.Cells[Map.Cells.Count - 1 - C]).Power; 1968 end; 1969 end; 1970 1958 1971 for I := 0 to Players.Count - 1 do 1959 1972 with TPlayer(Players[I]) do begin … … 1969 1982 raise Exception.Create(SCannotSetPlayerStartCells); 1970 1983 end; 1984 if SymetricMap and (I = 1) then 1985 StartCell := TCell(Map.Cells[Map.Cells.Count - 1 - Map.Cells.IndexOf(TPlayer(Players[0]).StartCell)]); 1986 1971 1987 StartCell.Terrain := ttCity; 1972 1988 StartCell.Player := TPlayer(Players[I]);
Note:
See TracChangeset
for help on using the changeset viewer.