Changeset 199
- Timestamp:
- May 16, 2018, 2:48:57 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormChat.lfm
r179 r199 8 8 ClientWidth = 527 9 9 DesignTimePPI = 120 10 LCLVersion = '1.8. 0.6'10 LCLVersion = '1.8.2.0' 11 11 object MemoChat: TMemo 12 12 Left = 8 -
trunk/Forms/UFormChat.pas
r185 r199 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 UGame, UGameClient , SpecializedList;9 UGame, UGameClient; 10 10 11 11 type -
trunk/Forms/UFormNew.pas
r198 r199 132 132 private 133 133 Players: TPlayers; 134 ServerList: TServerList; 134 135 public 135 ServerList: TServerList;136 136 procedure Translate; 137 137 procedure ReloadView; … … 334 334 AServerAdd.Enabled := RadioButtonModeNetworkClient.Checked; 335 335 AServerModify.Enabled := RadioButtonModeNetworkClient.Checked; 336 PageControl2.TabIndex := ComboBoxWinObjective.ItemIndex; 336 337 end; 337 338 … … 359 360 begin 360 361 Players := TPlayers.Create; 362 ServerList := TServerList.Create; 361 363 FormChat := TFormChat.Create(nil); 362 364 FormChat.ManualDock(PanelChat, nil, alClient); … … 383 385 procedure TFormNew.ComboBoxWinObjectiveChange(Sender: TObject); 384 386 begin 385 PageControl2.TabIndex := ComboBoxWinObjective.ItemIndex;387 UpdateInterface; 386 388 end; 387 389 … … 483 485 procedure TFormNew.FormDestroy(Sender: TObject); 484 486 begin 487 FreeAndNil(ServerList); 485 488 FreeAndNil(Players); 486 489 FreeAndNil(FormChat); … … 490 493 begin 491 494 with Server do begin 492 CheckBoxSymetricMap.Checked := Game.SymetricMap;493 CheckBoxVoid.Checked := Game.VoidEnabled;494 SpinEditVoidPercent.Value := Game.VoidPercentage;495 SpinEditVoidPercent.Enabled := Game.VoidEnabled;496 Players.Assign(Game.PlayersSetting);497 CheckBoxCity.Checked := Game.CityEnabled;498 SpinEditCityPercent.Value := Game.CityPercentage;499 SpinEditMapSizeX.Value := Game.Map.Size.X;500 SpinEditMapSizeY.Value := Game.Map.Size.Y;501 TrackBarSizeX.Position := Game.Map.Size.X;502 TrackBarSizeY.Position := Game.Map.Size.Y;503 RadioGroupGrowAmount.ItemIndex := Integer(Game.GrowAmount);504 RadioGroupGrowCells.ItemIndex := Integer(Game.GrowCells);505 ComboBoxGridType.ItemIndex := Integer(Game.MapType) - 1;506 ComboBoxWinObjective.ItemIndex := Integer(Game.WinObjective);507 SpinEditNeutralUnits.Value := Game.MaxNeutralUnits;508 ComboBoxMapShape.ItemIndex := Integer(Game.Map.Shape);509 EditImageFile.Text := Game.MapImageFileName;510 CheckBoxFogOfWar.Checked := Game.FogOfWar;511 CheckBoxBridges.Checked := Game.BridgeEnabled;512 495 RadioButtonModeLocal.Checked := Mode = smLocal; 513 496 RadioButtonModeNetworkClient.Checked := Mode = smNetworkClient; … … 515 498 EditServerAddress.Text := LocalNetworkAddress; 516 499 SpinEditServerPort.Value := LocalNetworkPort; 517 SpinEditMaxPower.Value := Game.MaxPower; 518 SpinEditTurns.Value := Game.StayAliveForDefinedTurns; 519 SpinEditSpecialCells.Value := Game.SpecialCaptureCellCount; 500 end; 501 ServerList.Assign(Core.ServerList); 502 Players.Assign(Core.GameSettings.Players); 503 with Core.GameSettings do begin 504 CheckBoxSymetricMap.Checked := SymetricMap; 505 CheckBoxVoid.Checked := VoidEnabled; 506 SpinEditVoidPercent.Value := VoidPercentage; 507 SpinEditVoidPercent.Enabled := VoidEnabled; 508 CheckBoxCity.Checked := CityEnabled; 509 SpinEditCityPercent.Value := CityPercentage; 510 SpinEditMapSizeX.Value := Map.Size.X; 511 SpinEditMapSizeY.Value := Map.Size.Y; 512 TrackBarSizeX.Position := Map.Size.X; 513 TrackBarSizeY.Position := Map.Size.Y; 514 RadioGroupGrowAmount.ItemIndex := Integer(GrowAmount); 515 RadioGroupGrowCells.ItemIndex := Integer(GrowCells); 516 ComboBoxGridType.ItemIndex := Integer(MapType) - 1; 517 ComboBoxWinObjective.ItemIndex := Integer(WinObjective); 518 SpinEditNeutralUnits.Value := MaxNeutralUnits; 519 ComboBoxMapShape.ItemIndex := Integer(Map.Shape); 520 EditImageFile.Text := MapImageFileName; 521 CheckBoxFogOfWar.Checked := FogOfWar; 522 CheckBoxBridges.Checked := BridgeEnabled; 523 SpinEditMaxPower.Value := MaxPower; 524 SpinEditTurns.Value := StayAliveForDefinedTurns; 525 SpinEditSpecialCells.Value := SpecialCaptureCellCount; 520 526 end; 521 527 end; … … 536 542 RemoteNetworkPort := 0; 537 543 end; 538 Game.PlayersSetting.Assign(Players); 539 Game.SymetricMap := CheckBoxSymetricMap.Checked; 540 Game.VoidEnabled := CheckBoxVoid.Checked; 541 Game.VoidPercentage := SpinEditVoidPercent.Value; 542 Game.CityEnabled := CheckBoxCity.Checked; 543 Game.CityPercentage := SpinEditCityPercent.Value; 544 Game.Map.Size := TPoint.Create(SpinEditMapSizeX.Value, SpinEditMapSizeY.Value); 545 Game.GrowAmount := TGrowAmount(RadioGroupGrowAmount.ItemIndex); 546 Game.GrowCells := TGrowCells(RadioGroupGrowCells.ItemIndex); 547 Game.MapType := TMapType(ComboBoxGridType.ItemIndex + 1); 548 Game.WinObjective := TWinObjective(ComboBoxWinObjective.ItemIndex); 549 Game.MaxNeutralUnits := SpinEditNeutralUnits.Value; 550 Game.Map.Shape := TMapShape(ComboBoxMapShape.ItemIndex); 551 Game.MapImageFileName := EditImageFile.Text; 552 Game.FogOfWar := CheckBoxFogOfWar.Checked; 553 Game.BridgeEnabled := CheckBoxBridges.Checked; 554 Game.MaxPower := SpinEditMaxPower.Value; 555 Game.StayAliveForDefinedTurns := SpinEditTurns.Value; 556 Game.SpecialCaptureCellCount := SpinEditSpecialCells.Value; 544 end; 545 Core.GameSettings.Players.Assign(Players); 546 Core.ServerList.Assign(ServerList); 547 with Core.GameSettings do begin 548 SymetricMap := CheckBoxSymetricMap.Checked; 549 VoidEnabled := CheckBoxVoid.Checked; 550 VoidPercentage := SpinEditVoidPercent.Value; 551 CityEnabled := CheckBoxCity.Checked; 552 CityPercentage := SpinEditCityPercent.Value; 553 Map.Size := TPoint.Create(SpinEditMapSizeX.Value, SpinEditMapSizeY.Value); 554 GrowAmount := TGrowAmount(RadioGroupGrowAmount.ItemIndex); 555 GrowCells := TGrowCells(RadioGroupGrowCells.ItemIndex); 556 MapType := TMapType(ComboBoxGridType.ItemIndex + 1); 557 WinObjective := TWinObjective(ComboBoxWinObjective.ItemIndex); 558 MaxNeutralUnits := SpinEditNeutralUnits.Value; 559 Map.Shape := TMapShape(ComboBoxMapShape.ItemIndex); 560 MapImageFileName := EditImageFile.Text; 561 FogOfWar := CheckBoxFogOfWar.Checked; 562 BridgeEnabled := CheckBoxBridges.Checked; 563 MaxPower := SpinEditMaxPower.Value; 564 StayAliveForDefinedTurns := SpinEditTurns.Value; 565 SpecialCaptureCellCount := SpinEditSpecialCells.Value; 557 566 end; 558 567 end; -
trunk/UCore.pas
r197 r199 83 83 public 84 84 Game: TGame; 85 GameSettings: TGame; 85 86 Server: TServer; 86 87 UseSingleView: Boolean; … … 312 313 try 313 314 FormNew.Load(Server); 314 FormNew.ServerList := ServerList;315 315 if FormNew.ShowModal = mrOk then begin 316 316 FormNew.Save(Server); 317 Game.Assign(GameSettings); 317 318 StartNewGame; 318 319 GameLoaded := False; … … 399 400 Server := TServer.Create; 400 401 Clients := TClients.Create; 402 GameSettings := TGame.Create; 401 403 Game := TGame.Create; 402 404 Game.OnMoveUpdated := DoMoveUpdated; … … 424 426 FreeAndNil(Clients); 425 427 FreeAndNil(Game); 428 FreeAndNil(GameSettings); 426 429 end; 427 430 … … 557 560 558 561 // Update translated default player names 559 Game .PlayersSetting[0].Name := SPlayer + ' 1';560 Game .PlayersSetting[1].Name := SPlayer + ' 2';562 GameSettings.Players[0].Name := SPlayer + ' 1'; 563 GameSettings.Players[1].Name := SPlayer + ' 2'; 561 564 562 565 LoadConfig; 563 Game .LoadConfig(XMLConfig1, 'Game');566 GameSettings.LoadConfig(XMLConfig1, 'Game'); 564 567 Server.LoadConfig(XMLConfig1, 'Server'); 565 568 ServerList.LoadConfig(XmlConfig1, 'ServerList'); … … 576 579 procedure TCore.Done; 577 580 begin 578 Game .SaveConfig(XMLConfig1, 'Game');581 GameSettings.SaveConfig(XMLConfig1, 'Game'); 579 582 Server.SaveConfig(XMLConfig1, 'Server'); 580 583 ServerList.SaveConfig(XmlConfig1, 'ServerList'); -
trunk/UGame.pas
r198 r199 329 329 Moves: TUnitMoves; 330 330 Computer: TComputer; 331 procedure Reset; 331 332 function IsAlive: Boolean; 332 333 procedure Clear; … … 442 443 procedure CalculatePlayersDistance; 443 444 procedure PropagatePlayerDistance(List: TCells); 444 procedure InitDefaultPlayers Setting;445 procedure InitDefaultPlayers; 445 446 procedure WinObjectiveMapPrepare; 446 447 public 447 448 DevelMode: Boolean; 448 449 Players: TPlayers; 449 PlayersSetting: TPlayers;450 450 Map: TMap; 451 451 MapImageFileName: string; … … 467 467 BridgeEnabled: Boolean; 468 468 MaxPower: Integer; 469 procedure Assign(Source: TGame); 469 470 function AttackProbability(AttackCount, DefendCount: Integer): Double; 470 471 procedure LoadConfig(Config: TXmlConfig; Path: string); … … 2809 2810 end; 2810 2811 2812 procedure TPlayer.Reset; 2813 begin 2814 Moves.Clear; 2815 PlayerMap.Cells.Clear; 2816 TotalUnits := 0; 2817 TotalCells := 0; 2818 TotalCities := 0; 2819 TotalDiscovered := 0; 2820 TurnStats.Clear; 2821 StartCell := nil; 2822 end; 2823 2811 2824 function TPlayer.IsAlive: Boolean; 2812 2825 begin … … 3199 3212 end; 3200 3213 3201 procedure TGame.InitDefaultPlayers Setting;3202 begin 3203 Players Setting.Clear;3204 Players Setting.New(SPlayer + ' 1', clBlue, pmHuman);3205 Players Setting.New(SPlayer + ' 2', clRed, pmComputer);3214 procedure TGame.InitDefaultPlayers; 3215 begin 3216 Players.Clear; 3217 Players.New(SPlayer + ' 1', clBlue, pmHuman); 3218 Players.New(SPlayer + ' 2', clRed, pmComputer); 3206 3219 end; 3207 3220 … … 3226 3239 Cells.Free; 3227 3240 end; 3241 end; 3242 3243 procedure TGame.Assign(Source: TGame); 3244 begin 3245 DevelMode := Source.DevelMode; 3246 Players.Assign(Source.Players); 3247 MapType := Source.MapType; 3248 Map.Assign(Source.Map); 3249 MapImageFileName := Source.MapImageFileName; 3250 VoidEnabled := Source.VoidEnabled; 3251 VoidPercentage := Source.VoidPercentage; 3252 SymetricMap := Source.SymetricMap; 3253 GrowCells := Source.GrowCells; 3254 GrowAmount := Source.GrowAmount; 3255 CityEnabled := Source.CityEnabled; 3256 CityPercentage := Source.CityPercentage; 3257 TurnCounter := Source.TurnCounter; 3258 WinObjective := Source.WinObjective; 3259 SpecialCaptureCellCount := Source.SpecialCaptureCellCount; 3260 StayAliveForDefinedTurns := Source.StayAliveForDefinedTurns; 3261 MaxNeutralUnits := Source.MaxNeutralUnits; 3262 FileName := Source.FileName; 3263 FogOfWar := Source.FogOfWar; 3264 BridgeEnabled := Source.BridgeEnabled; 3265 MaxPower := Source.MaxPower; 3228 3266 end; 3229 3267 … … 3248 3286 SetValue(DOMString(Path + '/StayAliveForDefinedTurns'), StayAliveForDefinedTurns); 3249 3287 SetValue(DOMString(Path + '/SpecialCaptureCellCount'), SpecialCaptureCellCount); 3250 Players Setting.SaveConfig(Config, Path + '/Players');3288 Players.SaveConfig(Config, Path + '/Players'); 3251 3289 end; 3252 3290 end; … … 3282 3320 StayAliveForDefinedTurns := GetValue(DOMString(Path + '/StayAliveForDefinedTurns'), 20); 3283 3321 SpecialCaptureCellCount := GetValue(DOMString(Path + '/SpecialCaptureCellCount'), 1); 3284 Players Setting.LoadConfig(Config, Path + '/Players');3322 Players.LoadConfig(Config, Path + '/Players'); 3285 3323 end; 3286 3324 end; … … 3499 3537 Players := TPlayers.Create; 3500 3538 Players.Game := Self; 3501 PlayersSetting := TPlayers.Create;3502 PlayersSetting.Game := Self;3503 3539 3504 3540 MapImageFileName := 'Images/Maps/WorldMap.png'; 3505 3541 Randomize; 3506 InitDefaultPlayers Setting;3542 InitDefaultPlayers; 3507 3543 3508 3544 VoidEnabled := True; … … 3517 3553 destructor TGame.Destroy; 3518 3554 begin 3519 FreeAndNil(PlayersSetting);3520 3555 FreeAndNil(Players); 3521 3556 FreeAndNil(Map); … … 3524 3559 3525 3560 procedure TGame.Clear; 3526 begin 3527 Players.Clear; 3561 var 3562 I: Integer; 3563 begin 3564 for I := 0 to Players.Count - 1 do Players[I].Clear; 3528 3565 Map.Clear; 3529 3566 end; … … 3551 3588 end; 3552 3589 3553 Players.Assign(PlayersSetting);3554 3590 for Player in Players do Player.StartCell := nil; 3555 3591 I := 0; -
trunk/UGameServer.pas
r196 r199 6 6 7 7 uses 8 Classes, SysUtils, UGame, UGameClient, DOM, XMLConf, fgl, SpecializedList,8 Classes, SysUtils, UGame, DOM, XMLConf, fgl, 9 9 UGameProtocol; 10 10 -
trunk/UServerList.pas
r196 r199 21 21 MapName: string; 22 22 Latency: TTime; 23 procedure Assign(Source: TServerInfo); 23 24 constructor Create; 24 25 end; … … 33 34 Address: string; 34 35 Items: TServerInfos; 36 procedure Assign(Source: TServerList); 35 37 constructor Create; 36 38 destructor Destroy; override; … … 47 49 { TServerInfo } 48 50 51 procedure TServerInfo.Assign(Source: TServerInfo); 52 begin 53 Name := Source.Name; 54 Address := Source.Address; 55 Port := Source.Port; 56 PlayersCountCurrent := Source.PlayersCountCurrent; 57 PlayersCountMax := Source.PlayersCountMax; 58 Password := Source.Password; 59 MapName := Source.MapName; 60 Latency := Source.Latency; 61 end; 62 49 63 constructor TServerInfo.Create; 50 64 begin … … 53 67 54 68 { TServerList } 69 70 procedure TServerList.Assign(Source: TServerList); 71 var 72 I: Integer; 73 begin 74 while Items.Count > Source.Items.Count do 75 Items.Delete(Items.Count - 1); 76 while Items.Count < Source.Items.Count do 77 Items.Add(TServerInfo.Create); 78 for I := 0 to Items.Count - 1 do begin 79 Items[I].Assign(Source.Items[I]); 80 end; 81 end; 55 82 56 83 constructor TServerList.Create; -
trunk/xtactics.lpi
r198 r199 279 279 <Linking> 280 280 <Debugging> 281 <UseHeaptrc Value="True"/> 281 282 <UseExternalDbgSyms Value="True"/> 282 283 </Debugging> -
trunk/xtactics.lpr
r198 r199 25 25 // Heap trace 26 26 DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 27 //SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);27 SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 28 28 {$ENDIF} 29 29
Note:
See TracChangeset
for help on using the changeset viewer.