- Timestamp:
- Mar 24, 2019, 2:26:29 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormNew.lfm
r282 r287 1 1 object FormNew: TFormNew 2 Left = 5462 Left = 478 3 3 Height = 745 4 Top = 1844 Top = 526 5 5 Width = 1211 6 6 Caption = 'New game' … … 15 15 OnShow = FormShow 16 16 Position = poMainFormCenter 17 LCLVersion = ' 1.8.4.0'17 LCLVersion = '2.0.0.4' 18 18 object PageControl1: TPageControl 19 19 Left = 4 … … 21 21 Top = 60 22 22 Width = 806 23 ActivePage = TabSheet Map23 ActivePage = TabSheetRules 24 24 Align = alClient 25 25 BorderSpacing.Around = 4 26 TabIndex = 226 TabIndex = 3 27 27 TabOrder = 0 28 28 OnChange = PageControl1Change … … 258 258 object ComboBoxGridType: TComboBox 259 259 Left = 146 260 Height = 42260 Height = 38 261 261 Top = 104 262 262 Width = 304 … … 275 275 object ComboBoxMapShape: TComboBox 276 276 Left = 146 277 Height = 42277 Height = 38 278 278 Top = 144 279 279 Width = 304 … … 519 519 object ComboBoxWinObjective: TComboBox 520 520 Left = 224 521 Height = 42521 Height = 38 522 522 Top = 244 523 523 Width = 328 … … 579 579 object TabSheetCaptureCells: TTabSheet 580 580 ClientHeight = 74 581 ClientWidth = 76 9581 ClientWidth = 763 582 582 object Label14: TLabel 583 583 Left = 8 … … 601 601 object TabSheetStayAliveTurns: TTabSheet 602 602 ClientHeight = 74 603 ClientWidth = 76 9603 ClientWidth = 763 604 604 object Label13: TLabel 605 605 Left = 8 … … 647 647 Caption = 'Ok' 648 648 ModalResult = 1 649 OnClick = ButtonOkClick 649 650 TabOrder = 0 650 651 end -
trunk/Forms/UFormNew.pas
r282 r287 105 105 procedure ButtonGameSystemsClick(Sender: TObject); 106 106 procedure ButtonImageBrowseClick(Sender: TObject); 107 procedure ButtonOkClick(Sender: TObject); 107 108 procedure ButtonRandomizeClick(Sender: TObject); 108 109 procedure CheckBoxBridgesChange(Sender: TObject); … … 138 139 procedure TrackBarSizeXChange(Sender: TObject); 139 140 private 140 Players: TPlayers;141 FServer: TServer; 141 142 ServerList: TServerList; 142 143 GamePreview: TGame; … … 144 145 NewRandSeed: Cardinal; 145 146 FormPlayers: TFormPlayers; 146 GameSystem: TGameSystem;147 147 procedure LoadGame(Game: TGame); 148 148 procedure SaveGame(Game: TGame); 149 procedure Load(Server: TServer); 150 procedure Save(Server: TServer); 149 151 procedure MapPreviewPaint; 150 152 procedure MapPreviewRedraw; 151 153 procedure ReloadGameSystemsMenu; 154 procedure SetServer(AValue: TServer); 152 155 public 153 156 procedure Translate; 154 157 procedure ReloadView; 155 158 procedure UpdateInterface; 156 procedure Load(Server: TServer); 157 procedure Save(Server: TServer); 159 property Server: TServer read FServer write SetServer; 158 160 end; 159 161 … … 278 280 procedure TFormNew.LoadGame(Game: TGame); 279 281 begin 280 FormPlayers.Players.Assign(Game.Players);281 282 with Game do begin 282 283 CheckBoxSymetricMap.Checked := SymetricMap; … … 303 304 SpinEditTurns.Value := StayAliveForDefinedTurns; 304 305 SpinEditSpecialCells.Value := SpecialCaptureCellCount; 306 GameSystem := Game.GameSystem; 305 307 ComboBoxGameSystem.ItemIndex := ComboBoxGameSystem.Items.IndexOf(GameSystemName); 308 if (ComboBoxGameSystem.ItemIndex = -1) and (ComboBoxGameSystem.Items.Count > 0) then 309 ComboBoxGameSystem.ItemIndex := 0; 306 310 end; 307 311 end; … … 309 313 procedure TFormNew.SaveGame(Game: TGame); 310 314 begin 311 Game.Players.Assign(FormPlayers.Players);312 315 with Game do begin 313 316 StoredRandSeed := NewRandSeed; … … 332 335 StayAliveForDefinedTurns := SpinEditTurns.Value; 333 336 SpecialCaptureCellCount := SpinEditSpecialCells.Value; 334 GameSystem := TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]); 335 GameSystemName := GameSystem.GetName; 337 if ComboBoxGameSystem.ItemIndex <> -1 then begin 338 GameSystem := TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]); 339 GameSystemName := GameSystem.GetName; 340 end else begin 341 GameSystem := nil; 342 GameSystemName := ''; 343 end; 336 344 end; 337 345 end; … … 366 374 finally 367 375 ComboBoxGameSystem.Items.EndUpdate; 376 end; 377 if (ComboBoxGameSystem.ItemIndex = -1) and (ComboBoxGameSystem.Items.Count > 0) then 378 ComboBoxGameSystem.ItemIndex := 0; 379 end; 380 381 procedure TFormNew.SetServer(AValue: TServer); 382 begin 383 if FServer = AValue then Exit; 384 FServer := AValue; 385 if Assigned(FServer) then begin 386 Load(FServer); 387 FormPlayers.Players := FServer.Game.Players; 388 end else begin 389 FormPlayers.Players := nil; 368 390 end; 369 391 end; … … 452 474 ListViewServers.Items.Count := ServerList.Items.Count; 453 475 ListViewServers.Refresh; 454 Translate;455 476 UpdateInterface; 456 477 end; … … 460 481 WinObjective: TWinObjective; 461 482 begin 462 GameSystem := TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]); 463 ComboBoxGridType.Enabled := GameSystem.PreferedMapType = mtNone;464 if GameSystem.PreferedMapType <> mtNone then465 ComboBoxGridType.ItemIndex := ComboBoxGridType.Items.IndexOfObject(TObject( GameSystem.PreferedMapType));483 484 ComboBoxGridType.Enabled := FServer.Game.GameSystem.PreferedMapType = mtNone; 485 if FServer.Game.GameSystem.PreferedMapType <> mtNone then 486 ComboBoxGridType.ItemIndex := ComboBoxGridType.Items.IndexOfObject(TObject(FServer.Game.GameSystem.PreferedMapType)); 466 487 EditImageFile.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage); 467 488 ButtonImageBrowse.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage); … … 513 534 FormChat.Align := alClient; 514 535 FormChat.Show; 515 Players := TPlayers.Create;516 Players.Game := GamePreview;517 536 FormPlayers := TFormPlayers.Create(nil); 518 537 FormPlayers.MinItemCount := MinPlayerCount; 519 538 FormPlayers.MaxItemCount := MaxPlayerCount; 520 FormPlayers.Players := Players;521 539 FormPlayers.ManualDock(Panel2, nil, alClient); 522 540 FormPlayers.Align := alClient; … … 549 567 procedure TFormNew.ComboBoxGameSystemChange(Sender: TObject); 550 568 begin 569 FServer.Game.GameSystem := TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]); 551 570 UpdateInterface; 552 571 MapPreviewRedraw; … … 641 660 end; 642 661 662 procedure TFormNew.ButtonOkClick(Sender: TObject); 663 begin 664 Save(FServer); 665 end; 666 643 667 procedure TFormNew.ButtonRandomizeClick(Sender: TObject); 644 668 begin … … 657 681 FreeAndNil(ServerList); 658 682 FreeAndNil(FormChat); 659 FreeAndNil(Players);660 683 FreeAndNil(FormPlayers); 661 684 FreeAndNil(GamePreview); … … 673 696 end; 674 697 ServerList.Assign(Core.ServerList); 675 LoadGame( Core.GameSettings);698 LoadGame(Server.Game); 676 699 end; 677 700 … … 693 716 end; 694 717 Core.ServerList.Assign(ServerList); 695 SaveGame( Core.GameSettings);718 SaveGame(Server.Game); 696 719 end; 697 720 -
trunk/Forms/UFormPlayers.lfm
r282 r287 12 12 OnDestroy = FormDestroy 13 13 OnShow = FormShow 14 LCLVersion = ' 1.8.4.0'14 LCLVersion = '2.0.0.4' 15 15 object ListView1: TListView 16 16 Left = 0 -
trunk/Forms/UFormUnitKind.lfm
r277 r287 8 8 ClientWidth = 480 9 9 DesignTimePPI = 144 10 LCLVersion = ' 1.8.4.0'10 LCLVersion = '2.0.0.4' 11 11 object LabelName: TLabel 12 12 Left = 20 … … 56 56 Caption = 'OK' 57 57 ModalResult = 1 58 OnClick = ButtonOkClick 58 59 TabOrder = 3 59 60 end -
trunk/Forms/UFormUnitKind.pas
r277 r287 20 20 LabelHealth: TLabel; 21 21 SpinEditHealth: TSpinEdit; 22 procedure ButtonOkClick(Sender: TObject); 22 23 private 23 24 public 24 FUnitKind: TUnitKind; 25 25 procedure Load(UnitKind: TUnitKind); 26 26 procedure Save(UnitKind: TUnitKind); 27 procedure SetUnitKind(AValue: TUnitKind); 28 public 29 property UnitKind: TUnitKind read FUnitKind write SetUnitKind; 27 30 end; 28 31 … … 48 51 end; 49 52 53 procedure TFormUnitKind.ButtonOkClick(Sender: TObject); 54 begin 55 Save(FUnitKind); 56 end; 57 58 procedure TFormUnitKind.SetUnitKind(AValue: TUnitKind); 59 begin 60 if FUnitKind = AValue then Exit; 61 FUnitKind := AValue; 62 if Assigned(AValue) then Load(FUnitKind); 63 end; 64 50 65 end. 51 66 -
trunk/Forms/UFormUnitKinds.lfm
r277 r287 11 11 OnCreate = FormCreate 12 12 OnShow = FormShow 13 LCLVersion = ' 1.8.4.0'13 LCLVersion = '2.0.0.4' 14 14 object ListView1: TListView 15 15 Left = 0 -
trunk/Forms/UFormUnitKinds.pas
r284 r287 98 98 FormUnitKind := TFormUnitKind.Create(Self); 99 99 try 100 FormUnitKind. Load(TempEntry);100 FormUnitKind.UnitKind := TempEntry; 101 101 if FormUnitKind.ShowModal = mrOk then begin 102 FormUnitKind.Save(TempEntry);103 102 TUnitKind(ListView1.Selected.Data).Assign(TempEntry); 104 103 UpdateList; … … 120 119 try 121 120 TempEntry.Name := SNewUnitKind; 122 FormUnitKind. Load(TempEntry);121 FormUnitKind.UnitKind := TempEntry; 123 122 if FormUnitKind.ShowModal = mrOk then begin 124 FormUnitKind.Save(TempEntry);125 123 UnitKinds.Add(TempEntry); 126 124 TempEntry := nil; -
trunk/UCore.lfm
r275 r287 4 4 OldCreateOrder = False 5 5 Height = 811 6 HorizontalOffset = 4 247 VerticalOffset = 3746 HorizontalOffset = 417 7 VerticalOffset = 418 8 8 Width = 1258 9 9 PPI = 144 -
trunk/UCore.pas
r284 r287 353 353 354 354 procedure TCore.AGameNewExecute(Sender: TObject); 355 var 356 NewServer: TServer; 355 357 begin 356 358 FormNew := TFormNew.Create(nil); 357 359 try 358 FormNew.Load(Server); 360 NewServer := TServer.Create; 361 NewServer.Assign(Server); 362 NewServer.Game := TGame.Create; 363 NewServer.Game.Assign(GameSettings); 364 FormNew.Server := NewServer; 359 365 FormNew.PageControl1.TabIndex := FormNewTabIndex; 360 366 if FormNew.ShowModal = mrOk then begin 367 Server.Assign(NewServer); 368 Server.Game := Game; 361 369 Game.Running := False; 362 FormNew.Save(Server);363 Game Settings.PostConfig;364 Game .Assign(GameSettings);370 Game.PostConfig; 371 Game.Assign(NewServer.Game); 372 GameSettings.Assign(NewServer.Game); 365 373 SaveConfigAll; 366 374 StartNewGame; … … 368 376 end; 369 377 FormNewTabIndex := FormNew.PageControl1.TabIndex; 378 NewServer.Game.Free; 379 NewServer.Game := nil; 380 NewServer.Free; 370 381 finally 371 382 FormNew.Free; -
trunk/UGame.pas
r282 r287 730 730 if FGameSystem = AValue then Exit; 731 731 FGameSystem := AValue; 732 if Assigned(FGameSystem) then GameSystemName := FGameSystem.GetName 733 else GameSystemName := ''; 732 734 end; 733 735 -
trunk/UGameServer.pas
r231 r287 64 64 constructor Create; 65 65 destructor Destroy; override; 66 procedure Assign(Source: TServer); 66 67 property Game: TGame read FGame write SetGame; 67 68 property Mode: TServerMode read FServerMode write SetServerMode; … … 142 143 begin 143 144 if FGame = AValue then Exit; 145 if Assigned(FGame) then 146 FGame.OnChange := nil; 144 147 FGame := AValue; 145 148 for I := 0 to Clients.Count - 1 do … … 278 281 end; 279 282 283 procedure TServer.Assign(Source: TServer); 284 begin 285 Mode := Source.Mode; 286 Game := Source.Game; 287 LocalNetworkAddress := Source.LocalNetworkAddress; 288 LocalNetworkPort := Source.LocalNetworkPort; 289 RemoteNetworkAddress := Source.RemoteNetworkAddress; 290 RemoteNetworkPort := Source.RemoteNetworkPort; 291 //Active := Source.Active; 292 end; 293 280 294 end. 281 295 -
trunk/xtactics.lpi
r284 r287 2 2 <CONFIG> 3 3 <ProjectOptions> 4 <Version Value="1 0"/>4 <Version Value="11"/> 5 5 <General> 6 6 <SessionStorage Value="InProjectDir"/> … … 78 78 </PublishOptions> 79 79 <RunParams> 80 <local> 81 <FormatVersion Value="1"/> 82 </local> 80 <FormatVersion Value="2"/> 81 <Modes Count="1"> 82 <Mode0 Name="default"/> 83 </Modes> 83 84 </RunParams> 84 85 <RequiredPackages Count="7">
Note:
See TracChangeset
for help on using the changeset viewer.