Changeset 38
- Timestamp:
- Mar 8, 2014, 10:34:55 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormNew.lfm
r36 r38 1 1 object FormNew: TFormNew 2 2 Left = 706 3 Height = 5 163 Height = 526 4 4 Top = 455 5 5 Width = 716 6 6 Caption = 'New game' 7 ClientHeight = 5 167 ClientHeight = 526 8 8 ClientWidth = 716 9 9 OnCreate = FormCreate … … 14 14 Left = 632 15 15 Height = 25 16 Top = 4 7916 Top = 490 17 17 Width = 75 18 Anchors = [akRight, akBottom] 18 19 Caption = 'Ok' 19 20 ModalResult = 1 … … 23 24 Left = 544 24 25 Height = 25 25 Top = 4 8026 Top = 491 26 27 Width = 75 28 Anchors = [akBottom] 27 29 Caption = 'Cancel' 28 30 ModalResult = 2 … … 32 34 Left = 16 33 35 Height = 24 34 Top = 17235 Width = 1 7536 Top = 276 37 Width = 194 36 38 Caption = 'Inaccessible places' 37 39 OnChange = CheckBoxVoidChange … … 89 91 Left = 16 90 92 Height = 22 91 Top = 22492 Width = 8893 Top = 184 94 Width = 99 93 95 Caption = 'Map width:' 94 96 ParentColor = False … … 97 99 Left = 136 98 100 Height = 32 99 Top = 219101 Top = 179 100 102 Width = 98 101 103 MinValue = 2 … … 107 109 Left = 136 108 110 Height = 32 109 Top = 2 70111 Top = 230 110 112 Width = 98 111 113 MinValue = 2 … … 127 129 Left = 224 128 130 Height = 32 129 Top = 168131 Top = 272 130 132 Width = 106 131 133 MinValue = 1 … … 136 138 Left = 339 137 139 Height = 22 138 Top = 173139 Width = 1 5140 Top = 277 141 Width = 17 140 142 Caption = '%' 141 143 ParentColor = False … … 144 146 Left = 248 145 147 Height = 43 146 Top = 216148 Top = 176 147 149 Width = 451 148 150 Max = 100 … … 157 159 Left = 248 158 160 Height = 43 159 Top = 2 64161 Top = 224 160 162 Width = 451 161 163 Max = 100 … … 170 172 Left = 16 171 173 Height = 22 174 Top = 232 175 Width = 106 176 Caption = 'Map height:' 177 ParentColor = False 178 end 179 object CheckBoxCity: TCheckBox 180 Left = 16 181 Height = 24 182 Top = 316 183 Width = 73 184 Caption = 'Cities' 185 OnChange = CheckBoxCityChange 186 TabOrder = 12 187 end 188 object SpinEditCityPercent: TSpinEdit 189 Left = 224 190 Height = 32 191 Top = 312 192 Width = 106 193 MinValue = 1 194 TabOrder = 13 195 Value = 1 196 end 197 object Label4: TLabel 198 Left = 339 199 Height = 22 200 Top = 317 201 Width = 17 202 Caption = '%' 203 ParentColor = False 204 end 205 object RadioGroupGrowAmount: TRadioGroup 206 Left = 376 207 Height = 76 172 208 Top = 272 173 Width = 94 174 Caption = 'Map height:' 175 ParentColor = False 209 Width = 241 210 AutoFill = True 211 Caption = 'Per turn grow amount' 212 ChildSizing.LeftRightSpacing = 6 213 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize 214 ChildSizing.EnlargeVertical = crsHomogenousChildResize 215 ChildSizing.ShrinkHorizontal = crsScaleChilds 216 ChildSizing.ShrinkVertical = crsScaleChilds 217 ChildSizing.Layout = cclLeftToRightThenTopToBottom 218 ChildSizing.ControlsPerLine = 1 219 ClientHeight = 52 220 ClientWidth = 237 221 Items.Strings = ( 222 'By one' 223 'By square root' 224 ) 225 TabOrder = 14 226 end 227 object RadioGroupGrowCells: TRadioGroup 228 Left = 16 229 Height = 105 230 Top = 360 231 Width = 185 232 AutoFill = True 233 Caption = 'Growing cells' 234 ChildSizing.LeftRightSpacing = 6 235 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize 236 ChildSizing.EnlargeVertical = crsHomogenousChildResize 237 ChildSizing.ShrinkHorizontal = crsScaleChilds 238 ChildSizing.ShrinkVertical = crsScaleChilds 239 ChildSizing.Layout = cclLeftToRightThenTopToBottom 240 ChildSizing.ControlsPerLine = 1 241 ClientHeight = 81 242 ClientWidth = 181 243 Items.Strings = ( 244 'None' 245 'Player cities' 246 'Player all' 247 ) 248 TabOrder = 15 176 249 end 177 250 end -
trunk/Forms/UFormNew.lrt
r36 r38 13 13 TFORMNEW.LABEL3.CAPTION=% 14 14 TFORMNEW.LABEL2.CAPTION=Map height: 15 TFORMNEW.CHECKBOXCITY.CAPTION=Cities 16 TFORMNEW.LABEL4.CAPTION=% 17 TFORMNEW.RADIOGROUPGROWAMOUNT.CAPTION=Per turn grow amount 18 TFORMNEW.RADIOGROUPGROWCELLS.CAPTION=Growing cells -
trunk/Forms/UFormNew.pas
r36 r38 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, Spin, UGame;9 ComCtrls, Spin, ExtCtrls, UGame; 10 10 11 11 type … … 20 20 ButtonPlayerModify: TButton; 21 21 CheckBoxVoid: TCheckBox; 22 CheckBoxCity: TCheckBox; 22 23 Label1: TLabel; 23 24 Label2: TLabel; 24 25 Label3: TLabel; 26 Label4: TLabel; 25 27 ListView1: TListView; 28 RadioGroupGrowCells: TRadioGroup; 29 RadioGroupGrowAmount: TRadioGroup; 26 30 SpinEditVoidPercent: TSpinEdit; 27 31 SpinEditMapSizeX: TSpinEdit; 28 32 SpinEditMapSizeY: TSpinEdit; 33 SpinEditCityPercent: TSpinEdit; 29 34 TrackBarSizeX: TTrackBar; 30 35 TrackBarSizeY: TTrackBar; … … 33 38 procedure ButtonPlayerModifyClick(Sender: TObject); 34 39 procedure ButtonPlayerRemoveClick(Sender: TObject); 40 procedure CheckBoxCityChange(Sender: TObject); 35 41 procedure CheckBoxVoidChange(Sender: TObject); 36 42 procedure FormCreate(Sender: TObject); … … 128 134 end; 129 135 136 procedure TFormNew.CheckBoxCityChange(Sender: TObject); 137 begin 138 SpinEditCityPercent.Enabled := CheckBoxCity.Checked; 139 end; 140 130 141 procedure TFormNew.CheckBoxVoidChange(Sender: TObject); 131 142 begin … … 177 188 TPlayer(Players[I]).Assign(TPlayer(Game.Players[I])); 178 189 end; 190 CheckBoxCity.Checked := Game.CityEnabled; 191 SpinEditCityPercent.Value := Game.CityPercentage; 179 192 SpinEditMapSizeX.Value := Game.Map.Size.X; 180 193 SpinEditMapSizeY.Value := Game.Map.Size.Y; 194 RadioGroupGrowAmount.ItemIndex := Integer(Game.GrowAmount); 195 RadioGroupGrowCells.ItemIndex := Integer(Game.GrowCells); 181 196 end; 182 197 … … 195 210 Game.VoidEnabled := CheckBoxVoid.Checked; 196 211 Game.VoidPercentage := SpinEditVoidPercent.Value; 212 Game.CityEnabled := CheckBoxCity.Checked; 213 Game.CityPercentage := SpinEditCityPercent.Value; 197 214 Game.Map.Size := Point(SpinEditMapSizeX.Value, SpinEditMapSizeY.Value); 215 Game.GrowAmount := TGrowAmount(RadioGroupGrowAmount.ItemIndex); 216 Game.GrowCells := TGrowCells(RadioGroupGrowCells.ItemIndex); 198 217 end; 199 218 -
trunk/Languages/xtactics.cs.po
r36 r38 149 149 msgstr "Nová hra" 150 150 151 #: tformnew.checkboxcity.caption 152 msgid "Cities" 153 msgstr "Města" 154 151 155 #: tformnew.checkboxvoid.caption 152 156 msgid "Inaccessible places" … … 154 158 155 159 #: tformnew.label1.caption 156 #, fuzzy157 160 #| msgid "Map size:" 158 161 msgid "Map width:" 159 msgstr " Velikostmapy:"162 msgstr "Šířka mapy:" 160 163 161 164 #: tformnew.label2.caption 162 #, fuzzy163 165 #| msgid "x" 164 166 msgid "Map height:" 165 msgstr " x"167 msgstr "Výška mapy:" 166 168 167 169 #: tformnew.label3.caption 170 msgctxt "tformnew.label3.caption" 171 msgid "%" 172 msgstr "%" 173 174 #: tformnew.label4.caption 175 msgctxt "tformnew.label4.caption" 168 176 msgid "%" 169 177 msgstr "%" … … 184 192 msgid "Start units" 185 193 msgstr "Počátečních jednotek" 194 195 #: tformnew.radiogroupgrowamount.caption 196 msgid "Per turn grow amount" 197 msgstr "Množství růstu za tah" 198 199 #: tformnew.radiogroupgrowcells.caption 200 msgid "Growing cells" 201 msgstr "Rostoucí buňky:" 186 202 187 203 #: tformplayer.buttoncancel.caption … … 256 272 msgid "You need at least two players" 257 273 msgstr "Potřebujete alespoň dva hráče" 258 -
trunk/Languages/xtactics.po
r36 r38 139 139 msgstr "" 140 140 141 #: tformnew.checkboxcity.caption 142 msgid "Cities" 143 msgstr "" 144 141 145 #: tformnew.checkboxvoid.caption 142 146 msgid "Inaccessible places" … … 152 156 153 157 #: tformnew.label3.caption 158 msgctxt "tformnew.label3.caption" 159 msgid "%" 160 msgstr "" 161 162 #: tformnew.label4.caption 163 msgctxt "TFORMNEW.LABEL4.CAPTION" 154 164 msgid "%" 155 165 msgstr "" … … 169 179 #: tformnew.listview1.columns[3].caption 170 180 msgid "Start units" 181 msgstr "" 182 183 #: tformnew.radiogroupgrowamount.caption 184 msgid "Per turn grow amount" 185 msgstr "" 186 187 #: tformnew.radiogroupgrowcells.caption 188 msgid "Growing cells" 171 189 msgstr "" 172 190 -
trunk/UGame.pas
r37 r38 24 24 TPointArray = array of TPoint; 25 25 26 TTerrainType = (ttVoid, ttNormal );26 TTerrainType = (ttVoid, ttNormal, ttCity); 27 27 28 28 { TCell } … … 160 160 Update: Boolean; var Confirm: Boolean) of object; 161 161 TWinEvent = procedure(Player: TPlayer) of object; 162 TGrowAmount = (gaByOne, gaBySquareRoot); 163 TGrowCells = (gcNone, gcPlayerCities, gcPlayerAll); 162 164 163 165 TGame = class … … 177 179 VoidEnabled: Boolean; 178 180 VoidPercentage: Integer; 181 GrowCells: TGrowCells; 182 GrowAmount: TGrowAmount; 183 CityEnabled: Boolean; 184 CityPercentage: Integer; 179 185 CurrentPlayer: TPlayer; 180 186 Moves: TObjectList; // TList<TMove> … … 499 505 CanAttack := 0; 500 506 for I := 0 to Length(Cells) - 1 do 501 if (Cells[I].Player <> Self) then begin507 if (Cells[I].Player <> Self) and (Cells[I].Terrain <> ttVoid) then begin 502 508 Inc(CanAttack); 503 509 end; … … 729 735 SetValue(Path + '/MapSizeX', Map.Size.X); 730 736 SetValue(Path + '/MapSizeY', Map.Size.Y); 737 SetValue(Path + '/CityEnabled', CityEnabled); 738 SetValue(Path + '/CityPercentage', CityPercentage); 739 SetValue(Path + '/GrowAmount', Integer(GrowAmount)); 740 SetValue(Path + '/GrowCells', Integer(GrowCells)); 731 741 end; 732 742 end; … … 739 749 Map.Size := Point(GetValue(Path + '/MapSizeX', 15), 740 750 GetValue(Path + '/MapSizeY', 15)); 751 CityEnabled := GetValue(Path + '/CityEnabled', True); 752 CityPercentage := GetValue(Path + '/CityPercentage', 10); 753 GrowAmount := TGrowAmount(GetValue(Path + '/GrowAmount', Integer(gaBySquareRoot))); 754 GrowCells := TGrowCells(GetValue(Path + '/GrowCells', Integer(gcPlayerAll))); 741 755 end; 742 756 end; … … 841 855 with Map.Cells[Y, X] do begin 842 856 if VoidEnabled and (Random < VoidPercentage / 100) then Terrain := ttVoid 843 else Terrain := ttNormal; 857 else begin 858 if CityEnabled and (Random < CityPercentage / 100) then Terrain := ttCity 859 else Terrain := ttNormal; 860 end; 844 861 Power := Random(4); 845 862 Player := nil; … … 858 875 raise Exception.Create('Cannot choose start cell for player'); 859 876 end; 860 StartCell.Terrain := ttNormal; 877 if CityEnabled then StartCell.Terrain := ttCity 878 else StartCell.Terrain := ttNormal; 861 879 StartCell.Player := TPlayer(Players[I]); 862 880 StartCell.Power := TPlayer(Players[I]).StartUnits; … … 950 968 end; 951 969 if (CX >= 0) and (CY >= 0) and (CY < Size.Y) and (CX < Size.X) then 952 if Cells[CY, CX].Terrain = ttNormalthen begin970 if Cells[CY, CX].Terrain <> ttVoid then begin 953 971 Points := GetHexagonPolygon(Point(Trunc(X * CellSize.X), 954 972 Trunc(Y * CellSize.Y)), … … 1004 1022 Pen.Style := psSolid; 1005 1023 Pen.Width := 1; 1024 end else 1025 if TCell(Cells[CY, CX]).Terrain = ttCity then begin 1026 // Cannot set clear border as it will display shifted on gtk2 1027 //Pen.Style := psClear; 1028 Pen.Color := clBlack; 1029 Pen.Style := psSolid; 1030 Pen.Width := 3; 1006 1031 end else begin 1007 Pen.Color := clBlack;1008 1032 // Cannot set clear border as it will display shifted on gtk2 1009 1033 //Pen.Style := psClear; … … 1038 1062 if (CX >= 0) and (CY >= 0) and (CY < Size.Y) and (CX < Size.X) then begin 1039 1063 Cell := Cells[CY, CX]; 1040 if Cell.Terrain = ttNormalthen begin1064 if Cell.Terrain <> ttVoid then begin 1041 1065 if Assigned(SelectedCell) and (SelectedCell = TCell(Cells[CY, CX])) then Brush.Color := clGreen 1042 1066 else if Assigned(SelectedCell) and IsCellsNeighbor(SelectedCell, TCell(Cells[CY, CX])) then Brush.Color := clPurple … … 1082 1106 var 1083 1107 X, Y: Integer; 1108 Addition: Integer; 1084 1109 begin 1085 1110 for Y := 0 to Size.Y - 1 do 1086 1111 for X := 0 to Size.X - 1 do 1087 1112 with TCell(Cells[Y, X]) do begin 1088 if Player = APlayer then begin 1089 Power := Power + 1; 1113 if (Player = APlayer) and ((Game.GrowCells = gcPlayerAll) or 1114 ((Game.GrowCells = gcPlayerCities) and (Terrain = ttCity))) then begin 1115 if Game.GrowAmount = gaByOne then Addition := 1 1116 else if Game.GrowAmount = gaBySquareRoot then begin 1117 Addition := Trunc(Sqrt(Power)); 1118 if Addition = 0 then Addition := 1; 1119 end; 1120 Power := Power + Addition; 1090 1121 if Power > MaxPower then Power := MaxPower; 1091 1122 end;
Note:
See TracChangeset
for help on using the changeset viewer.