Changeset 55
- Timestamp:
- Aug 18, 2014, 9:34:15 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormNew.lfm
r47 r55 240 240 end 241 241 object RadioGroupGrowAmount: TRadioGroup 242 Left = 3 60242 Left = 376 243 243 Height = 76 244 244 Top = 97 245 Width = 241245 Width = 305 246 246 AutoFill = True 247 247 Caption = 'Per turn grow amount' … … 254 254 ChildSizing.ControlsPerLine = 1 255 255 ClientHeight = 49 256 ClientWidth = 237256 ClientWidth = 301 257 257 Items.Strings = ( 258 258 'By one' … … 264 264 Left = 8 265 265 Height = 105 266 Top = 18 5267 Width = 185266 Top = 184 267 Width = 312 268 268 AutoFill = True 269 269 Caption = 'Growing cells' … … 276 276 ChildSizing.ControlsPerLine = 1 277 277 ClientHeight = 78 278 ClientWidth = 181278 ClientWidth = 308 279 279 Items.Strings = ( 280 280 'None' … … 285 285 end 286 286 object ComboBoxGridType: TComboBox 287 Left = 312288 Height = 3 7287 Left = 473 288 Height = 33 289 289 Top = 201 290 290 Width = 208 … … 299 299 end 300 300 object Label5: TLabel 301 Left = 216301 Left = 336 302 302 Height = 25 303 303 Top = 201 … … 315 315 end 316 316 object ComboBoxWinObjective: TComboBox 317 Left = 160318 Height = 3 7317 Left = 232 318 Height = 33 319 319 Top = 305 320 Width = 208320 Width = 328 321 321 ItemHeight = 0 322 322 Items.Strings = ( … … 338 338 end 339 339 object SpinEditNeutralUnits: TSpinEdit 340 Left = 272341 Height = 35 342 Top = 34 3340 Left = 384 341 Height = 35 342 Top = 344 343 343 Width = 98 344 344 MaxValue = 99 -
trunk/Forms/UFormNew.pas
r42 r55 69 69 Players: TPlayers; 70 70 public 71 procedure Translate; 71 72 procedure ReloadView; 72 73 procedure Load(Game: TGame); … … 82 83 83 84 uses 84 UFormPlayer; 85 UFormPlayer, UCore; 86 87 resourcestring 88 SGridTypeHexagon = 'Hexagonal'; 89 SGridTypeSquare = 'Square'; 90 SGridTypeTriangle = 'Triangonal'; 91 SGridTypeVoronoi = 'Voronoi random'; 92 SWinObjectiveDefeatAllOponents = 'Defeat all oponents'; 93 SWinObjectiveDefeatAllCities = 'Defeat all oponents cities'; 94 SWinObjectiveCapturePosition = 'Capture position'; 95 SWinObjectiveStayAliveForTurns = 'Stay alive for number of turns'; 96 SGrowNone = 'None'; 97 SGrowPlayerCities = 'Player cities'; 98 SGrowPlayerAllCells = 'Player all cells'; 99 SGrowAmountByOne = 'By one'; 100 SGrowAmountBySquareRoot = 'By square root'; 101 85 102 86 103 { TFormNew } … … 141 158 end; 142 159 160 procedure TFormNew.Translate; 161 var 162 LastIndex: Integer; 163 begin 164 with ComboBoxGridType do begin 165 LastIndex := ItemIndex; 166 Clear; 167 Items.Add(SGridTypeHexagon); 168 Items.Add(SGridTypeSquare); 169 Items.Add(SGridTypeTriangle); 170 if Core.DevelMode then 171 Items.Add(SGridTypeVoronoi); 172 ItemIndex := LastIndex; 173 end; 174 with ComboBoxWinObjective do begin 175 LastIndex := ItemIndex; 176 Clear; 177 Items.Add(SWinObjectiveDefeatAllOponents); 178 Items.Add(SWinObjectiveDefeatAllCities); 179 Items.Add(SWinObjectiveCapturePosition); 180 Items.Add(SWinObjectiveStayAliveForTurns); 181 ItemIndex := LastIndex; 182 end; 183 with RadioGroupGrowCells do begin 184 LastIndex := ItemIndex; 185 Items.Clear; 186 Items.Add(SGrowNone); 187 Items.Add(SGrowPlayerCities); 188 Items.Add(SGrowPlayerAllCells); 189 ItemIndex := LastIndex; 190 end; 191 with RadioGroupGrowAmount do begin 192 LastIndex := ItemIndex; 193 Items.Clear; 194 Items.Add(SGrowAmountByOne); 195 Items.Add(SGrowAmountBySquareRoot); 196 ItemIndex := LastIndex; 197 end; 198 end; 199 143 200 procedure TFormNew.ReloadView; 144 201 begin … … 148 205 ButtonPlayerAdd.Enabled := Players.Count < MaxPlayerCount; 149 206 APlayerModify.Enabled := Assigned(ListView1.Selected); 207 Translate; 150 208 end; 151 209 -
trunk/Forms/UFormPlayer.pas
r29 r55 25 25 { private declarations } 26 26 public 27 procedure Translate; 27 28 procedure Load(Player: TPlayer); 28 29 procedure Save(Player: TPlayer); … … 36 37 {$R *.lfm} 37 38 39 resourcestring 40 SHuman = 'Human'; 41 SComputer = 'Computer'; 42 38 43 { TFormPlayer } 44 45 procedure TFormPlayer.Translate; 46 var 47 LastIndex: Integer; 48 begin 49 with ComboBox1 do begin 50 LastIndex := ItemIndex; 51 Clear; 52 Items.Add(SHuman); 53 Items.Add(SComputer); 54 ItemIndex := LastIndex; 55 end; 56 end; 39 57 40 58 procedure TFormPlayer.Load(Player: TPlayer); -
trunk/Forms/UFormSettings.lfm
r33 r55 29 29 object Label1: TLabel 30 30 Left = 20 31 Height = 2 231 Height = 25 32 32 Top = 26 33 Width = 8033 Width = 95 34 34 Caption = 'Language:' 35 35 ParentColor = False … … 37 37 object ComboBoxLanguage: TComboBox 38 38 Left = 178 39 Height = 3 239 Height = 37 40 40 Top = 24 41 41 Width = 196 … … 44 44 TabOrder = 2 45 45 end 46 object CheckBoxDevelMode: TCheckBox 47 Left = 16 48 Height = 27 49 Top = 80 50 Width = 176 51 Caption = 'Developer mode' 52 TabOrder = 3 53 end 46 54 end -
trunk/Forms/UFormSettings.lrt
r33 r55 3 3 TFORMSETTINGS.BUTTONCANCEL.CAPTION=Cancel 4 4 TFORMSETTINGS.LABEL1.CAPTION=Language: 5 TFORMSETTINGS.CHECKBOXDEVELMODE.CAPTION=Developer mode -
trunk/Forms/UFormSettings.pas
r33 r55 15 15 ButtonOk: TButton; 16 16 ButtonCancel: TButton; 17 CheckBoxDevelMode: TCheckBox; 17 18 ComboBoxLanguage: TComboBox; 18 19 Label1: TLabel; … … 41 42 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language); 42 43 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 44 CheckBoxDevelMode.Checked := Core.DevelMode; 43 45 end; 44 46 … … 47 49 if ComboBoxLanguage.ItemIndex <> -1 then 48 50 Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]); 51 Core.DevelMode := CheckBoxDevelMode.Checked; 49 52 end; 50 53 -
trunk/Languages/xtactics.cs.po
r46 r55 14 14 msgctxt "tcore.aabout.caption" 15 15 msgid "About" 16 msgstr " "16 msgstr "O aplikaci" 17 17 18 18 #: tcore.aexit.caption … … 82 82 msgctxt "tformabout.caption" 83 83 msgid "About" 84 msgstr " "84 msgstr "O aplikaci" 85 85 86 86 #: tformabout.okbutton.caption 87 87 msgid "OK" 88 msgstr " "88 msgstr "OK" 89 89 90 90 #: tformmain.atoolbarbigicons.caption 91 91 msgid "Toolbar big icons" 92 msgstr " "92 msgstr "Velké ikony panelu" 93 93 94 94 #: tformmain.azoomall.caption … … 118 118 #: tformmain.menuitem16.caption 119 119 msgid "Help" 120 msgstr " "120 msgstr "Nápověda" 121 121 122 122 #: tformmain.menuitem19.caption … … 327 327 msgstr "Nastavení" 328 328 329 #: tformsettings.checkboxdevelmode.caption 330 msgid "Developer mode" 331 msgstr "Vývojářský režim" 332 329 333 #: tformsettings.label1.caption 330 334 msgid "Language:" … … 338 342 #: uformabout.sapplicationname 339 343 msgid "Application name" 340 msgstr " "344 msgstr "Název aplikace" 341 345 342 346 #: uformabout.semail 343 347 msgid "E-mail" 344 msgstr " "348 msgstr "E-mail" 345 349 346 350 #: uformabout.shomepage 347 351 msgid "Homepage" 348 msgstr " "352 msgstr "Domovská stránka" 349 353 350 354 #: uformabout.smanufacturer 351 355 msgid "Company" 352 msgstr " "356 msgstr "Společnost" 353 357 354 358 #: uformabout.sreleasedate 355 359 msgid "Release date" 356 msgstr " "360 msgstr "Datum uvolnění" 357 361 358 362 #: uformabout.sversion 359 363 msgid "Version" 360 msgstr " "364 msgstr "Verze" 361 365 362 366 #: uformmain.sturn … … 364 368 msgstr "tah" 365 369 370 #: uformnew.sgridtypehexagon 371 msgid "Hexagonal" 372 msgstr "Hexagonální" 373 374 #: uformnew.sgridtypesquare 375 msgid "Square" 376 msgstr "Čtvercová" 377 378 #: uformnew.sgridtypetriangle 379 msgid "Triangonal" 380 msgstr "Trojúhelníková" 381 382 #: uformnew.sgridtypevoronoi 383 msgid "Voronoi random" 384 msgstr "Náhodná Voroného" 385 386 #: uformnew.sgrowamountbyone 387 msgid "By one" 388 msgstr "O jeden" 389 390 #: uformnew.sgrowamountbysquareroot 391 msgid "By square root" 392 msgstr "O odmocninu" 393 394 #: uformnew.sgrownone 395 msgid "None" 396 msgstr "Nikde" 397 398 #: uformnew.sgrowplayerallcells 399 msgid "Player all cells" 400 msgstr "Všechny buňky hráče" 401 402 #: uformnew.sgrowplayercities 403 msgid "Player cities" 404 msgstr "Města hráče" 405 406 #: uformnew.swinobjectivecaptureposition 407 msgid "Capture position" 408 msgstr "Dobít pozici" 409 410 #: uformnew.swinobjectivedefeatallcities 411 msgid "Defeat all oponents cities" 412 msgstr "Porazit všechny města nepřátelů" 413 414 #: uformnew.swinobjectivedefeatalloponents 415 msgid "Defeat all oponents" 416 msgstr "Porazit všechny nepřátele" 417 418 #: uformnew.swinobjectivestayaliveforturns 419 msgid "Stay alive for number of turns" 420 msgstr "Zůstat naživu určený počet tahů" 421 422 #: uformplayer.scomputer 423 msgctxt "uformplayer.scomputer" 424 msgid "Computer" 425 msgstr "Počítač" 426 427 #: uformplayer.shuman 428 msgctxt "uformplayer.shuman" 429 msgid "Human" 430 msgstr "Člověk" 431 366 432 #: ugame.scannotsetplayerstartcells 367 433 msgid "Cannot choose start cell for player" … … 369 435 370 436 #: ugame.scomputer 437 msgctxt "ugame.scomputer" 371 438 msgid "Computer" 372 439 msgstr "Počítač" … … 384 451 msgid "Unfinished battle" 385 452 msgstr "Neukončená bitva" 386 -
trunk/Languages/xtactics.po
r46 r55 315 315 msgstr "" 316 316 317 #: tformsettings.checkboxdevelmode.caption 318 msgid "Developer mode" 319 msgstr "" 320 317 321 #: tformsettings.label1.caption 318 322 msgid "Language:" … … 352 356 msgstr "" 353 357 358 #: uformnew.sgridtypehexagon 359 msgid "Hexagonal" 360 msgstr "" 361 362 #: uformnew.sgridtypesquare 363 msgid "Square" 364 msgstr "" 365 366 #: uformnew.sgridtypetriangle 367 msgid "Triangonal" 368 msgstr "" 369 370 #: uformnew.sgridtypevoronoi 371 msgid "Voronoi random" 372 msgstr "" 373 374 #: uformnew.sgrowamountbyone 375 msgid "By one" 376 msgstr "" 377 378 #: uformnew.sgrowamountbysquareroot 379 msgid "By square root" 380 msgstr "" 381 382 #: uformnew.sgrownone 383 msgid "None" 384 msgstr "" 385 386 #: uformnew.sgrowplayerallcells 387 msgid "Player all cells" 388 msgstr "" 389 390 #: uformnew.sgrowplayercities 391 msgid "Player cities" 392 msgstr "" 393 394 #: uformnew.swinobjectivecaptureposition 395 msgid "Capture position" 396 msgstr "" 397 398 #: uformnew.swinobjectivedefeatallcities 399 msgid "Defeat all oponents cities" 400 msgstr "" 401 402 #: uformnew.swinobjectivedefeatalloponents 403 msgid "Defeat all oponents" 404 msgstr "" 405 406 #: uformnew.swinobjectivestayaliveforturns 407 msgid "Stay alive for number of turns" 408 msgstr "" 409 410 #: uformplayer.scomputer 411 msgctxt "uformplayer.scomputer" 412 msgid "Computer" 413 msgstr "" 414 415 #: uformplayer.shuman 416 msgctxt "uformplayer.shuman" 417 msgid "Human" 418 msgstr "" 419 354 420 #: ugame.scannotsetplayerstartcells 355 421 msgid "Cannot choose start cell for player" … … 357 423 358 424 #: ugame.scomputer 425 msgctxt "ugame.scomputer" 359 426 msgid "Computer" 360 427 msgstr "" -
trunk/UCore.pas
r43 r55 51 51 Game: TGame; 52 52 UseSingleView: Boolean; 53 DevelMode: Boolean; 53 54 LastMapFileName: string; 54 55 View: TView; 56 procedure UpdateActions; 55 57 procedure Init; 56 58 property Initialized: Boolean read FInitialized; … … 66 68 67 69 uses 68 UFormMove, UFormMain, UFormNew, UFormSettings, UFormAbout ;70 UFormMove, UFormMain, UFormNew, UFormSettings, UFormAbout, UFormPlayer; 69 71 70 72 resourcestring … … 98 100 end; 99 101 102 procedure TCore.UpdateActions; 103 begin 104 Core.AGameEndTurn.Enabled := Core.Game.Running; 105 Core.AGameEnd.Enabled := Core.Game.Running; 106 end; 107 100 108 procedure TCore.AExitExecute(Sender: TObject); 101 109 begin … … 113 121 Game.Running := False; 114 122 FormMain.Redraw; 123 UpdateActions; 115 124 end; 116 125 … … 127 136 Sleep(1); 128 137 end; 138 UpdateActions; 129 139 end; 130 140 … … 147 157 Game.Running := True; 148 158 FormMain.AZoomAll.Execute; 159 UpdateActions; 149 160 end; 150 161 end; … … 154 165 Game.New; 155 166 Game.Running := True; 167 FormMain.AZoomAll.Execute; 156 168 FormMain.Redraw; 169 UpdateActions; 157 170 end; 158 171 … … 178 191 begin 179 192 UGame.InitStrings; 193 FormNew.Translate; 194 FormPlayer.Translate; 180 195 end; 181 196 … … 192 207 XMLConfig1.SetValue('Language', CoolTranslator1.Language.Code); 193 208 XMLConfig1.SetValue('LastMapFileName', LastMapFileName); 209 XMLConfig1.SetValue('DevelMode', DevelMode); 194 210 FreeAndNil(Game); 195 211 end; … … 201 217 FInitialized := True; 202 218 LastMapFileName := XMLConfig1.GetValue('LastMapFileName', ''); 219 DevelMode := XMLConfig1.GetValue('DevelMode', false); 203 220 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(XMLConfig1.GetValue('Language', '')); 204 221 for I := 0 to Game.Players.Count - 1 do -
trunk/UGame.pas
r54 r55 92 92 procedure PaintCell(Canvas: TCanvas; Pos: TPoint; Text: string; View: TView; 93 93 Cell: TCell); 94 procedure DrawArrow(Canvas: TCanvas; View: TView; Pos: TPoint; Angle: Double; 95 Text: string); 94 96 procedure SetSize(AValue: TPoint); virtual; 95 97 public … … 98 100 DefaultCellSize: TPoint; 99 101 Cells: TObjectList; // TList<TCell> 100 procedure DrawArrow(Canvas: TCanvas; View: TView; Pos: TPoint; Angle: Double;101 Text: string);102 102 function IsCellsNeighbor(Cell1, Cell2: TCell): Boolean; virtual; 103 103 function IsValidIndex(Index: TPoint): Boolean; virtual; … … 151 151 public 152 152 function IsValidIndex(Index: TPoint): Boolean; override; 153 procedure Generate; override; 154 end; 155 156 { TVoronoiMap } 157 158 TVoronoiMap = class(TMap) 159 private 160 function GetTrianglePolygon(Pos: TPoint; Size: TPoint; Reverse: Boolean): TPointArray; 161 public 153 162 procedure Generate; override; 154 163 end; … … 210 219 TGrowAmount = (gaByOne, gaBySquareRoot); 211 220 TGrowCells = (gcNone, gcPlayerCities, gcPlayerAll); 212 TMapType = (mtNone, mtHexagon, mtSquare, mtTriangle );221 TMapType = (mtNone, mtHexagon, mtSquare, mtTriangle, mtVoronoi); 213 222 TWinObjective = (woDefeatAllOponents, woDefeatAllOponentsCities, 214 223 woSpecialCaptureCell, woStayAliveForDefinedTurns); … … 345 354 end; 346 355 356 { TVoronoiMap } 357 358 function TVoronoiMap.GetTrianglePolygon(Pos: TPoint; Size: TPoint; 359 Reverse: Boolean): TPointArray; 360 begin 361 362 end; 363 364 procedure TVoronoiMap.Generate; 365 var 366 X, Y: Integer; 367 I, J, PI: Integer; 368 V, VN: Integer; 369 NewCell: TCell; 370 Pos: TPoint; 371 begin 372 inherited; 373 // Free previous 374 Cells.Count := 0; 375 // Allocate and init new 376 Cells.Count := FSize.Y * FSize.X; 377 for Y := 0 to FSize.Y - 1 do 378 for X := 0 to FSize.X - 1 do begin 379 NewCell := TCell.Create; 380 NewCell.PosPx := Point(Trunc(Random * FSize.X * DefaultCellSize.X), Trunc(Random * FSize.Y * DefaultCellSize.Y)); 381 SetLength(NewCell.Polygon, 1); 382 NewCell.Polygon[0] := NewCell.PosPx; 383 Cells[Y * FSize.X + X] := NewCell; 384 end; 385 end; 386 347 387 { TTriangleMap } 348 388 … … 503 543 Brush.Style := bsClear; 504 544 Font.Color := clBlack; 505 Font.Size := Trunc( 4* View.Zoom);545 Font.Size := Trunc(16 * View.Zoom); 506 546 TextOut(Pos.X - TextWidth(Text) div 2, 507 547 Pos.Y - TextHeight(Text) div 2, Text); … … 624 664 Pen.Style := psSolid; 625 665 Font.Color := clWhite; 626 Font.Size := Trunc( 12 * View.Zoom);666 Font.Size := Trunc(42 * View.Zoom); 627 667 TextPos := View.CellToCanvasPos(Pos); 628 668 TextOut(Round(TextPos.X) - TextWidth(Text) div 2, Round(TextPos.Y) - TextHeight(Text) div 2, Text); … … 668 708 begin 669 709 MaxPower := 99; 670 DefaultCellSize := Point( 62, 62);710 DefaultCellSize := Point(220, 220); 671 711 Cells := TObjectList.create; 672 712 Size := Point(0, 0); … … 1128 1168 mtSquare: Map := TSquareMap.Create; 1129 1169 mtTriangle: Map := TTriangleMap.Create; 1170 mtVoronoi: Map := TVoronoiMap.Create; 1130 1171 else Map := TMap.Create; 1131 1172 end; … … 1432 1473 Shift := FloatPoint(0.5 * cos(30 / 180 * Pi), 0.5 * sin(30 / 180 * Pi)); 1433 1474 SetLength(Result, 6); 1434 Result[0] := Point( Round(Pos.X + 0 * Size.X), Round(Pos.Y - 0.5 * Size.Y));1435 Result[1] := Point( Round(Pos.X + Shift.X * Size.X), Round(Pos.Y - Shift.Y * Size.Y));1436 Result[2] := Point( Round(Pos.X + Shift.X * Size.X), Round(Pos.Y + Shift.Y * Size.Y));1437 Result[3] := Point( Round(Pos.X + 0 * Size.X), Round(Pos.Y + 0.5 * Size.Y));1438 Result[4] := Point( Round(Pos.X - Shift.X * Size.X), Round(Pos.Y + Shift.Y * Size.Y));1439 Result[5] := Point( Round(Pos.X - Shift.X * Size.X), Round(Pos.Y - Shift.Y * Size.Y));1475 Result[0] := Point(Trunc(Pos.X + 0 * Size.X), Trunc(Pos.Y - 0.5 * Size.Y)); 1476 Result[1] := Point(Trunc(Pos.X + Shift.X * Size.X), Trunc(Pos.Y - Shift.Y * Size.Y)); 1477 Result[2] := Point(Trunc(Pos.X + Shift.X * Size.X), Trunc(Pos.Y + Shift.Y * Size.Y)); 1478 Result[3] := Point(Trunc(Pos.X + 0 * Size.X), Trunc(Pos.Y + 0.5 * Size.Y)); 1479 Result[4] := Point(Trunc(Pos.X - Shift.X * Size.X), Trunc(Pos.Y + Shift.Y * Size.Y)); 1480 Result[5] := Point(Trunc(Pos.X - Shift.X * Size.X), Trunc(Pos.Y - Shift.Y * Size.Y)); 1440 1481 end; 1441 1482 -
trunk/xtactics.lpi
r47 r55 130 130 <HasResources Value="True"/> 131 131 <ResourceBaseClass Value="Form"/> 132 <UnitName Value="UFormMove"/>133 132 </Unit6> 134 133 <Unit7> … … 146 145 <HasResources Value="True"/> 147 146 <ResourceBaseClass Value="Form"/> 148 <UnitName Value="UFormAbout"/>149 147 </Unit8> 150 148 </Units> … … 176 174 <StackChecks Value="True"/> 177 175 </Checks> 178 <VerifyObjMethodCallValidity Value="True"/>179 176 </CodeGeneration> 180 177 <Linking>
Note:
See TracChangeset
for help on using the changeset viewer.