Changeset 222
- Timestamp:
- Jul 13, 2018, 11:13:12 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormClient.pas
r221 r222 477 477 Client.View.FocusedCell := Cell; 478 478 StatusBar1.Panels[0].Text := '[' + IntToStr(Cell.PosPx.X) + ', ' + IntToStr(Cell.PosPx.Y) + 479 '] (' + IntToStr(Cell.MovesFrom.Count) + ', ' + IntToStr(Cell.MovesTo.Count) + ') ';479 '] (' + IntToStr(Cell.MovesFrom.Count) + ', ' + IntToStr(Cell.MovesTo.Count) + ') ' + IntToStr(Cell.Id); 480 480 end else begin 481 481 Client.View.FocusedCell := nil; -
trunk/Forms/UFormMain.lfm
r221 r222 5 5 Width = 775 6 6 Caption = 'xTactics' 7 ClientHeight = 5 967 ClientHeight = 587 8 8 ClientWidth = 775 9 DesignTimePPI = 1 209 DesignTimePPI = 144 10 10 Menu = MainMenu1 11 11 OnClose = FormClose … … 14 14 OnKeyUp = FormKeyUp 15 15 OnShow = FormShow 16 LCLVersion = '1.8. 2.0'16 LCLVersion = '1.8.4.0' 17 17 WindowState = wsMaximized 18 18 object ToolBar1: TToolBar … … 78 78 object PanelMain: TPanel 79 79 Left = 0 80 Height = 5 5680 Height = 547 81 81 Top = 40 82 82 Width = 775 … … 192 192 Interval = 20 193 193 OnTimer = Timer1Timer 194 left = 1 54194 left = 128 195 195 top = 263 196 196 end -
trunk/Languages/xtactics.cs.po
r221 r222 1039 1039 msgid "64-bit UInt read overflow." 1040 1040 msgstr "Přetečení při čtení 64-bit UInt" 1041 -
trunk/UClientAI.pas
r213 r222 60 60 CanAttack := 0; 61 61 for NeighborCell in Neighbors do 62 if NeighborCell.Player = Game.CurrentPlayer then begin62 if NeighborCell.Player = ControlPlayer then begin 63 63 Inc(CanAttack); 64 64 end; … … 77 77 TotalPower := 0; 78 78 for NeighborCell in Neighbors do 79 if NeighborCell.Player = Game.CurrentPlayer then79 if NeighborCell.Player = ControlPlayer then 80 80 TotalPower := TotalPower + NeighborCell.GetAvialPower; 81 81 … … 84 84 TotalAttackPower := 0; 85 85 for NeighborCell in Neighbors do 86 if NeighborCell.Player = Game.CurrentPlayer then begin86 if NeighborCell.Player = ControlPlayer then begin 87 87 // Use only necessary power 88 88 AttackPower := Power - TotalAttackPower + AttackDiff; … … 109 109 NeighborCell: TCell; 110 110 begin 111 111 if ControlPlayer.Defensive then Exit; 112 112 113 113 AllCells := Game.Map.Cells; … … 188 188 for C := 0 to AllCells.Count - 1 do 189 189 with AllCells[C] do begin 190 if (Player <> Game.CurrentPlayer) and (Player <> nil) and (Terrain <> ttVoid) then begin190 if (Player <> ControlPlayer) and (Player <> nil) and (Terrain <> ttVoid) then begin 191 191 CanAttack := 0; 192 192 for I := 0 to Neighbors.Count - 1 do 193 if ((Neighbors[I].Player = Game.CurrentPlayer) or193 if ((Neighbors[I].Player = ControlPlayer) or 194 194 (Neighbors[I].Player = nil)) and (Neighbors[I].Terrain <> ttVoid) then begin 195 195 Inc(CanAttack); … … 218 218 for I := 0 to Neighbors.Count - 1 do begin 219 219 if (Neighbors[I].Terrain <> ttVoid) and (not Neighbors[I].Mark) then begin 220 if (TargetCells[C].Player = Game.CurrentPlayer) and221 (Neighbors[I].Player = Game.CurrentPlayer) then begin220 if (TargetCells[C].Player = ControlPlayer) and 221 (Neighbors[I].Player = ControlPlayer) then begin 222 222 // Do not take units from front line 223 223 Cells2 := Neighbors[I].Neighbors; 224 224 CanAttack := 0; 225 225 for J := 0 to Cells2.Count - 1 do 226 if ((Cells2[J].Player <> Game.CurrentPlayer) or (Cells2[J].Player = nil))226 if ((Cells2[J].Player <> ControlPlayer) or (Cells2[J].Player = nil)) 227 227 and (Cells2[J].Terrain <> ttVoid) then begin 228 228 Inc(CanAttack); … … 292 292 for C := 0 to AllCells.Count - 1 do 293 293 with AllCells[C] do begin 294 if (Terrain <> ttVoid) and (Player = Game.CurrentPlayer) then begin294 if (Terrain <> ttVoid) and (Player = ControlPlayer) then begin 295 295 if AttackersCount(AllCells[C]) > 0 then 296 296 BorderCells.Add(AllCells[C]); … … 305 305 EnemyPower := 0; 306 306 for I := 0 to Neighbors.Count - 1 do 307 if (Neighbors[I].Player <> Game.CurrentPlayer) and (Neighbors[I].Player <> nil) then begin307 if (Neighbors[I].Player <> ControlPlayer) and (Neighbors[I].Player <> nil) then begin 308 308 Inc(EnemyPower, Neighbors[I].Power); 309 309 end; … … 329 329 Result := 0; 330 330 for I := 0 to Cell.Neighbors.Count - 1 do 331 if (Cell.Neighbors[I].Player <> Game.CurrentPlayer) and331 if (Cell.Neighbors[I].Player <> ControlPlayer) and 332 332 (Cell.Neighbors[I].Player <> nil) then begin 333 333 Inc(Result); -
trunk/UCore.lfm
r221 r222 3 3 OnDestroy = DataModuleDestroy 4 4 OldCreateOrder = False 5 Height = 6766 HorizontalOffset = 3537 VerticalOffset = 3 128 Width = 1 0489 PPI = 1 205 Height = 811 6 HorizontalOffset = 424 7 VerticalOffset = 374 8 Width = 1258 9 PPI = 144 10 10 object ActionListMain: TActionList 11 11 Images = ImageListSmall 12 left = 1 1413 top = 5012 left = 137 13 top = 60 14 14 object AExit: TAction 15 15 Caption = 'Exit' … … 105 105 end 106 106 object ImageListSmall: TImageList 107 left = 655108 top = 350107 left = 786 108 top = 420 109 109 Bitmap = { 110 110 4C690C00000010000000100000000000000000000000E3AA4BD6E5B35EFFE3B1 … … 498 498 POFilesFolder = 'Languages' 499 499 OnTranslate = CoolTranslator1Translate 500 left = 1 14501 top = 363500 left = 137 501 top = 436 502 502 end 503 503 object ImageListLarge: TImageList 504 504 Height = 32 505 505 Width = 32 506 left = 655507 top = 2 38506 left = 786 507 top = 286 508 508 Bitmap = { 509 509 4C690C0000002000000020000000000000000000000000000000E2AA4B36E2A9 … … 2050 2050 RootName = 'CONFIG' 2051 2051 ReadOnly = False 2052 left = 1 142053 top = 4632052 left = 137 2053 top = 556 2054 2054 end 2055 2055 object OpenDialog1: TOpenDialog 2056 2056 DefaultExt = '.xtmap' 2057 left = 9382058 top = 2 432057 left = 1126 2058 top = 292 2059 2059 end 2060 2060 object SaveDialog1: TSaveDialog 2061 2061 DefaultExt = '.xtmap' 2062 left = 9382063 top = 1 382062 left = 1126 2063 top = 166 2064 2064 end 2065 2065 object ApplicationInfo: TApplicationInfo … … 2074 2074 AuthorsName = 'Chronos' 2075 2075 AppName = 'xTactics' 2076 ReleaseDate = 432 632076 ReleaseDate = 43293 2077 2077 RegistryKey = '\Software\xTactics' 2078 2078 RegistryRoot = rrKeyCurrentUser 2079 2079 License = 'CC0' 2080 left = 1 142081 top = 1 502080 left = 137 2081 top = 180 2082 2082 end 2083 2083 object PersistentForm: TPersistentForm 2084 2084 MinVisiblePart = 50 2085 2085 EntireVisible = False 2086 left = 6502087 top = 5002086 left = 780 2087 top = 600 2088 2088 end 2089 2089 object ScaleDPI1: TScaleDPI 2090 2090 AutoDetect = False 2091 left = 1 132092 top = 5632091 left = 136 2092 top = 676 2093 2093 end 2094 2094 object LastOpenedList1: TLastOpenedList 2095 2095 MaxCount = 10 2096 2096 OnChange = LastOpenedList1Change 2097 left = 1 142098 top = 2502097 left = 137 2098 top = 300 2099 2099 end 2100 2100 end -
trunk/UGame.pas
r220 r222 38 38 private 39 39 FArea: TMapArea; 40 FId: Integer; 40 41 FMap: TMap; 41 42 FPower: Integer; 42 43 procedure SetArea(AValue: TMapArea); 44 procedure SetId(AValue: Integer); 43 45 procedure SetPower(AValue: Integer); 44 46 public 45 Id: Integer;46 47 PosPx: TPoint; 47 48 Polygon: TPolygon; … … 58 59 Links: TCellLinks; 59 60 Extra: TExtraType; 61 property Id: Integer read FId write SetId; 60 62 procedure ConnectTo(Cell: TCell); 61 63 procedure DisconnectFrom(Cell: TCell); … … 226 228 procedure CreateLinks; 227 229 procedure Clear; 230 procedure CheckCells; 228 231 constructor Create; virtual; 229 232 destructor Destroy; override; … … 1688 1691 end; 1689 1692 1693 procedure TMap.CheckCells; 1694 var 1695 I: Integer; 1696 J: Integer; 1697 begin 1698 for I := 0 to Cells.Count - 1 do begin 1699 for J := I + 1 to Cells.Count - 1 do begin 1700 if (Cells[I].Id = Cells[J].Id) then 1701 raise Exception.Create('Duplicate cells ID ' + IntToStr(I) + ' ' + IntToStr(J)); 1702 if (Cells[I].PosPx = Cells[J].PosPx) then 1703 raise Exception.Create('Duplicate cells position ' + IntToStr(I) + ' ' + IntToStr(J)); 1704 end; 1705 end; 1706 end; 1707 1690 1708 constructor TMap.Create; 1691 1709 begin … … 1889 1907 FArea := AValue; 1890 1908 if Assigned(FArea) then FArea.Cells.Add(Self); 1909 end; 1910 1911 procedure TCell.SetId(AValue: Integer); 1912 begin 1913 if FId = AValue then Exit; 1914 FId := AValue; 1891 1915 end; 1892 1916 … … 2037 2061 constructor TCell.Create; 2038 2062 begin 2063 FId := -1; 2039 2064 Player := nil; 2040 2065 Neighbors := TCells.Create; … … 2451 2476 Confirm: Boolean; 2452 2477 begin 2478 if CellFrom.Player <> Self then 2479 raise Exception.Create('Can''t set move of other player.'); 2453 2480 Confirm := True; 2454 2481 Result := Moves.SearchByFromTo(CellFrom, CellTo); … … 2749 2776 I: Integer; 2750 2777 begin 2778 if AttackCount < 0 then raise Exception.Create('Attack power needs to be possitive' + IntToStr(AttackCount)); 2751 2779 if AttackCount = 0 then begin 2752 2780 Result := 0; 2753 2781 Exit; 2754 2782 end; 2783 if DefendCount < 0 then raise Exception.Create('Defend power needs to be possitive but is ' + IntToStr(DefendCount)); 2755 2784 if DefendCount = 0 then begin 2756 2785 Result := 1; … … 3187 3216 NewPlayerIndex: Integer; 3188 3217 begin 3218 {$IFDEF DEBUG} 3219 Map.CheckCells; 3220 {$ENDIF} 3221 3189 3222 // Finalize current player 3190 3223 CurrentPlayer.MoveAll; -
trunk/xtactics.lpr
r203 r222 11 11 CoolTranslator, TemplateGenerics 12 12 { you can add units after this }, 13 SysUtils, UFormMain, CoolStreaming , UFormServer, UClientAI, UGameConnection;13 SysUtils, UFormMain, CoolStreaming; 14 14 15 15 {$R *.res}
Note:
See TracChangeset
for help on using the changeset viewer.