Changeset 270 for trunk/UGame.pas
- Timestamp:
- Jan 28, 2019, 10:38:17 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r268 r270 53 53 procedure SetRunning(AValue: Boolean); 54 54 procedure BuildTerrain; 55 procedure PlaceCities; 55 56 procedure SelectPlayerStartCell(Player: TPlayer); 56 57 procedure CalculatePlayersDistance; … … 82 83 BridgeEnabled: Boolean; 83 84 MaxPower: Integer; 85 StoredRandSeed: Cardinal; 84 86 procedure PostConfig; 85 87 procedure Assign(Source: TGame); … … 291 293 if (VoidEnabled and (Random < VoidPercentage / 100)) or 292 294 (Map.IsOutsideShape(PosPx)) then Terrain := ttVoid 293 else begin 294 if CityEnabled and (Random < CityPercentage / 100) then Terrain := ttCity 295 else Terrain := ttNormal; 296 end; 295 else Terrain := ttNormal; 297 296 if not Assigned(OneUnit) then 298 297 OneUnit := Units.AddNew(GameSystem.UnitKinds[0], Random(MaxNeutralUnits + 1)); 299 298 Player := nil; 299 end; 300 end; 301 302 procedure TGame.PlaceCities; 303 var 304 Cell: TCell; 305 begin 306 for Cell in Map.Cells do 307 with Cell do begin 308 if (Terrain = ttNormal) and CityEnabled and (Random < CityPercentage / 100) then 309 Terrain := ttCity; 300 310 end; 301 311 end; … … 418 428 procedure TGame.Assign(Source: TGame); 419 429 begin 430 StoredRandSeed := Source.StoredRandSeed; 420 431 DevelMode := Source.DevelMode; 421 432 Players.Assign(Source.Players); … … 446 457 begin 447 458 with Config do begin 459 SetValue(DOMString(Path + '/RandSeed'), Integer(StoredRandSeed)); 448 460 SetValue(DOMString(Path + '/GridType'), Integer(MapType)); 449 461 SetValue(DOMString(Path + '/MapImage'), DOMString(MapImageFileName)); … … 473 485 begin 474 486 with Config do begin 487 StoredRandSeed := GetValue(DOMString(Path + '/RandSeed'), 0); 475 488 MapType := TMapType(GetValue(DOMString(Path + '/GridType'), Integer(mtHexagon))); 476 489 Map.Size := TPoint.Create(GetValue(DOMString(Path + '/MapSizeX'), 10), … … 518 531 RootNode := Doc.DocumentElement; 519 532 with RootNode do begin 533 StoredRandSeed := ReadInteger(RootNode, 'RandSeed', 0); 520 534 MapType := TMapType(ReadInteger(RootNode, 'MapType', Integer(mtNone))); 521 535 SymetricMap := ReadBoolean(RootNode, 'SymetricMap', False); … … 580 594 AppendChild(RootNode); 581 595 with RootNode do begin 596 WriteInteger(RootNode, 'RandSeed', Integer(StoredRandSeed)); 582 597 WriteInteger(RootNode, 'MapType', Integer(MapType)); 583 598 WriteBoolean(RootNode, 'SymetricMap', SymetricMap); … … 825 840 begin 826 841 Clear; 842 RandSeed := StoredRandSeed; 827 843 FileName := SNewGameFile; 828 844 TurnCounter := 1; … … 832 848 Map.MaxPower := MaxPower; 833 849 BuildTerrain; 850 PlaceCities; 834 851 WinObjectiveMapPrepare; 835 852
Note:
See TracChangeset
for help on using the changeset viewer.