Changeset 270
- Timestamp:
- Jan 28, 2019, 10:38:17 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormNew.lfm
r269 r270 518 518 Top = 272 519 519 Width = 359 520 Anchors = [akTop, akLeft, akRight] 521 OnResize = Image1Resize 520 522 end 521 523 object Label15: TLabel … … 523 525 Height = 26 524 526 Top = 240 525 Width = 147 526 Caption = 'Random preview:' 527 ParentColor = False 527 Width = 71 528 Caption = 'Preview:' 529 ParentColor = False 530 end 531 object ButtonRandomize: TButton 532 Left = 10 533 Height = 38 534 Top = 540 535 Width = 153 536 Caption = 'Randomize' 537 OnClick = ButtonRandomizeClick 538 TabOrder = 17 528 539 end 529 540 end -
trunk/Forms/UFormNew.pas
r269 r270 25 25 Button2: TButton; 26 26 Button3: TButton; 27 ButtonRandomize: TButton; 27 28 ButtonCancel: TButton; 28 29 ButtonImageBrowse: TButton; … … 115 116 procedure AServerRemoveExecute(Sender: TObject); 116 117 procedure ButtonImageBrowseClick(Sender: TObject); 118 procedure ButtonRandomizeClick(Sender: TObject); 117 119 procedure CheckBoxBridgesChange(Sender: TObject); 118 120 procedure CheckBoxCityChange(Sender: TObject); … … 128 130 procedure FormDestroy(Sender: TObject); 129 131 procedure FormShow(Sender: TObject); 132 procedure Image1Resize(Sender: TObject); 130 133 procedure ListViewPlayersCustomDrawSubItem(Sender: TCustomListView; 131 134 Item: TListItem; SubItem: Integer; State: TCustomDrawState; … … 159 162 GamePreview: TGame; 160 163 MapPreviewRedrawPending: Boolean; 164 NewRandSeed: Cardinal; 161 165 procedure LoadGame(Game: TGame); 162 166 procedure SaveGame(Game: TGame); … … 363 367 Game.Players.Assign(Players); 364 368 with Game do begin 369 StoredRandSeed := NewRandSeed; 365 370 SymetricMap := CheckBoxSymetricMap.Checked; 366 371 CyclicMap := CheckBoxCyclicMap.Checked; … … 397 402 Bitmap: TBitmap; 398 403 begin 404 Image1.Height := Round(Image1.Width * SpinEditMapSizeY.Value / SpinEditMapSizeX.Value); 399 405 GamePreview.GameSystem := Core.GameSystems.First; 400 406 SaveGame(GamePreview); … … 508 514 procedure TFormNew.FormShow(Sender: TObject); 509 515 begin 516 Randomize; 517 NewRandSeed := RandSeed; 510 518 Core.PersistentForm.Load(Self); 511 519 Core.ThemeManager1.UseTheme(Self); … … 517 525 TabSheetMode.Enabled := False; 518 526 {$ENDIF} 527 end; 528 529 procedure TFormNew.Image1Resize(Sender: TObject); 530 begin 531 MapPreviewRedraw; 519 532 end; 520 533 … … 667 680 EditImageFile.Text := OpenPictureDialog1.FileName; 668 681 end; 682 end; 683 684 procedure TFormNew.ButtonRandomizeClick(Sender: TObject); 685 begin 686 Randomize; 687 NewRandSeed := RandSeed; 688 MapPreviewRedraw; 669 689 end; 670 690 -
trunk/Languages/xtactics.cs.po
r269 r270 397 397 msgstr "Ok" 398 398 399 #: tformnew.buttonrandomize.caption 400 msgid "Randomize" 401 msgstr "Náhodně" 402 399 403 #: tformnew.caption 400 404 msgctxt "tformnew.caption" … … 459 463 460 464 #: tformnew.label15.caption 461 msgid " Random preview:"462 msgstr "Náh odný náhled:"465 msgid "Preview:" 466 msgstr "Náhled:" 463 467 464 468 #: tformnew.label2.caption -
trunk/Languages/xtactics.po
r269 r270 384 384 msgstr "" 385 385 386 #: tformnew.buttonrandomize.caption 387 msgid "Randomize" 388 msgstr "" 389 386 390 #: tformnew.caption 387 391 msgctxt "tformnew.caption" … … 445 449 446 450 #: tformnew.label15.caption 447 msgid " Random preview:"451 msgid "Preview:" 448 452 msgstr "" 449 453 -
trunk/UClientGUI.pas
r269 r270 169 169 Pen.Color := clBlack; 170 170 Pen.Style := psSolid; 171 Pen.Width := 3;171 Pen.Width := Trunc(5 * View.Zoom); 172 172 end else begin 173 173 // Cannot set clear border as it will display shifted on gtk2 -
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.