Changeset 397 for trunk/Game.pas
- Timestamp:
- Jan 6, 2025, 9:04:30 AM (2 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Game.pas
r377 r397 529 529 begin 530 530 with Config do begin 531 SetValue(DOMString(Path + '/RandSeed'), Integer(StoredRandSeed));531 SetValue(DOMString(Path + '/RandSeed'), DOMString(IntToStr(StoredRandSeed))); 532 532 SetValue(DOMString(Path + '/GridType'), Integer(MapType)); 533 533 SetValue(DOMString(Path + '/MapImage'), DOMString(MapImageFileName)); … … 558 558 var 559 559 Value: Integer; 560 ValueInt64: Int64; 560 561 begin 561 562 with Config do begin 562 StoredRandSeed := GetValue(DOMString(Path + '/RandSeed'), 0); 563 MapType := TMapType(GetValue(DOMString(Path + '/GridType'), Integer(mtHexagonVertical))); 564 Map.Size := TPoint.Create(GetValue(DOMString(Path + '/MapSizeX'), 10), 565 GetValue(DOMString(Path + '/MapSizeY'), 10)); 563 if TryStrToInt64(string(GetValue(DOMString(Path + '/RandSeed'), DOMString(IntToStr(StoredRandSeed)))), ValueInt64) then 564 StoredRandSeed := ValueInt64; 565 MapType := TMapType(GetValue(DOMString(Path + '/GridType'), Integer(MapType))); 566 Map.Size := TPoint.Create(GetValue(DOMString(Path + '/MapSizeX'), Map.Size.X), 567 GetValue(DOMString(Path + '/MapSizeY'), Map.Size.Y)); 566 568 MapImageFileName := string(GetValue(DOMString(Path + '/MapImage'), DOMString(MapImageFileName))); 567 SymetricMap := GetValue(DOMString(Path + '/SymetricMap'), False);568 CyclicMap := GetValue(DOMString(Path + '/CyclicMap'), False);569 FogOfWar := GetValue(DOMString(Path + '/FogOfWar'), F alse);570 VoidEnabled := GetValue(DOMString(Path + '/VoidEnabled'), True);571 VoidPercentage := GetValue(DOMString(Path + '/VoidPercentage'), 20);572 Value := GetValue(DOMString(Path + '/MapShape'), 0);569 SymetricMap := GetValue(DOMString(Path + '/SymetricMap'), SymetricMap); 570 CyclicMap := GetValue(DOMString(Path + '/CyclicMap'), CyclicMap); 571 FogOfWar := GetValue(DOMString(Path + '/FogOfWar'), FogOfWar); 572 VoidEnabled := GetValue(DOMString(Path + '/VoidEnabled'), VoidEnabled); 573 VoidPercentage := GetValue(DOMString(Path + '/VoidPercentage'), VoidPercentage); 574 Value := GetValue(DOMString(Path + '/MapShape'), Integer(Map.Shape)); 573 575 if (Value >= Integer(Low(TMapShape))) and (Value <= Integer(High(TMapShape))) then 574 576 Map.Shape := TMapShape(Value) else Map.Shape := Low(TMapShape); 575 CityEnabled := GetValue(DOMString(Path + '/CityEnabled'), False);576 CityPercentage := GetValue(DOMString(Path + '/CityPercentage'), 10);577 BridgeEnabled := GetValue(DOMString(Path + '/BridgeEnabled'), True);578 Value := GetValue(DOMString(Path + '/GrowAmount'), Integer( gaBySquareRoot));577 CityEnabled := GetValue(DOMString(Path + '/CityEnabled'), CityEnabled); 578 CityPercentage := GetValue(DOMString(Path + '/CityPercentage'), CityPercentage); 579 BridgeEnabled := GetValue(DOMString(Path + '/BridgeEnabled'), BridgeEnabled); 580 Value := GetValue(DOMString(Path + '/GrowAmount'), Integer(GrowAmount)); 579 581 if (Value >= Integer(Low(TGrowAmount))) and (Value <= Integer(High(TGrowAmount))) then 580 582 GrowAmount := TGrowAmount(Value) else GrowAmount := Low(TGrowAmount); 581 Value := GetValue(DOMString(Path + '/GrowCells'), Integer( gcPlayerAll));583 Value := GetValue(DOMString(Path + '/GrowCells'), Integer(GrowCells)); 582 584 if (Value >= Integer(Low(TGrowCells))) and (Value <= Integer(High(TGrowCells))) then 583 585 GrowCells := TGrowCells(Value) else GrowCells := Low(TGrowCells); 584 Value := GetValue(DOMString(Path + '/WinObjective'), Integer( woDefeatAllOponents));586 Value := GetValue(DOMString(Path + '/WinObjective'), Integer(WinObjective)); 585 587 if (Value >= Integer(Low(TWinObjective))) and (Value <= Integer(High(TWinObjective))) then 586 588 WinObjective := TWinObjective(Value) else WinObjective := Low(TWinObjective); 587 StayAliveForDefinedTurns := GetValue(DOMString(Path + '/StayAliveForDefinedTurns'), 20);588 SpecialCaptureCellCount := GetValue(DOMString(Path + '/SpecialCaptureCellCount'), 1);589 MaxNeutralUnits := GetValue(DOMString(Path + '/MaxNeutralUnits'), 5);590 MaxPower := GetValue(DOMString(Path + '/MaxPower'), 99);589 StayAliveForDefinedTurns := GetValue(DOMString(Path + '/StayAliveForDefinedTurns'), StayAliveForDefinedTurns); 590 SpecialCaptureCellCount := GetValue(DOMString(Path + '/SpecialCaptureCellCount'), SpecialCaptureCellCount); 591 MaxNeutralUnits := GetValue(DOMString(Path + '/MaxNeutralUnits'), MaxNeutralUnits); 592 MaxPower := GetValue(DOMString(Path + '/MaxPower'), MaxPower); 591 593 Players.LoadConfig(Config, Path + '/Players'); 592 594 end; … … 608 610 RootNode := Doc.DocumentElement; 609 611 with RootNode do begin 610 StoredRandSeed := ReadInt eger(RootNode, 'RandSeed', 0);612 StoredRandSeed := ReadInt64(RootNode, 'RandSeed', 0); 611 613 MapType := TMapType(ReadInteger(RootNode, 'MapType', Integer(mtNone))); 612 614 SymetricMap := ReadBoolean(RootNode, 'SymetricMap', False); … … 672 674 AppendChild(RootNode); 673 675 with RootNode do begin 674 WriteInteger(RootNode, 'RandSeed', Integer(StoredRandSeed)); 676 StoredRandSeed := RandSeed; 677 WriteInt64(RootNode, 'RandSeed', StoredRandSeed); 675 678 WriteInteger(RootNode, 'MapType', Integer(MapType)); 676 679 WriteBoolean(RootNode, 'SymetricMap', SymetricMap); … … 910 913 911 914 GeneratePlayers := True; 915 StoredRandSeed := RandSeed; 912 916 MapImageFileName := ''; 913 Randomize;914 StoredRandSeed := RandSeed;915 InitDefaultPlayers; 916 917 MapType := mtHexagonVertical; 918 Map.Size := TPoint.Create(10, 10); 919 920 CityPercentage := 20; 917 921 VoidEnabled := True; 918 922 VoidPercentage := 20; 919 923 MaxPower := DefaultMaxPower; 920 924 MaxNeutralUnits := Min(4, MaxPower); 921 922 Map.Size := TPoint.Create(3, 3); 925 BridgeEnabled := True; 926 MaxNeutralUnits := 5; 927 MaxPower := 99; 928 SpecialCaptureCellCount := 1; 929 StayAliveForDefinedTurns := 20; 930 WinObjective := woDefeatAllOponents; 931 GrowCells := gcPlayerAll; 932 GrowAmount := gaBySquareRoot; 933 934 InitDefaultPlayers; 923 935 end; 924 936
Note:
See TracChangeset
for help on using the changeset viewer.