Changeset 198
- Timestamp:
- May 16, 2018, 1:38:11 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormNew.lfm
r197 r198 505 505 'Stay alive for number of turns' 506 506 ) 507 OnChange = ComboBoxWinObjectiveChange 507 508 Style = csDropDownList 508 509 TabOrder = 1 … … 540 541 TabOrder = 3 541 542 end 542 object Label13: TLabel 543 Left = 8 544 Height = 20 545 Top = 280 546 Width = 111 547 Caption = 'Number of turns:' 548 ParentColor = False 549 end 550 object SpinEditTurns: TSpinEdit 551 Left = 236 552 Height = 28 553 Top = 278 554 Width = 159 555 MaxValue = 1000 556 MinValue = 1 543 object PageControl2: TPageControl 544 Left = 12 545 Height = 78 546 Top = 274 547 Width = 756 548 ActivePage = TabSheetCaptureCities 549 Anchors = [akTop, akLeft, akRight] 550 ShowTabs = False 551 TabIndex = 1 557 552 TabOrder = 4 558 Value = 1 553 object TabSheetDefeatEnemies: TTabSheet 554 end 555 object TabSheetCaptureCities: TTabSheet 556 end 557 object TabSheetCaptureCells: TTabSheet 558 ClientHeight = 70 559 ClientWidth = 748 560 object Label14: TLabel 561 Left = 8 562 Height = 20 563 Top = 16 564 Width = 125 565 Caption = 'Special cells count:' 566 ParentColor = False 567 end 568 object SpinEditSpecialCells: TSpinEdit 569 Left = 236 570 Height = 28 571 Top = 8 572 Width = 159 573 MaxValue = 1000 574 MinValue = 1 575 TabOrder = 0 576 Value = 1 577 end 578 end 579 object TabSheetStayAliveTurns: TTabSheet 580 ClientHeight = 70 581 ClientWidth = 748 582 object Label13: TLabel 583 Left = 8 584 Height = 20 585 Top = 16 586 Width = 111 587 Caption = 'Number of turns:' 588 ParentColor = False 589 end 590 object SpinEditTurns: TSpinEdit 591 Left = 236 592 Height = 28 593 Top = 8 594 Width = 159 595 MaxValue = 1000 596 MinValue = 1 597 TabOrder = 0 598 Value = 1 599 end 600 end 559 601 end 560 602 end -
trunk/Forms/UFormNew.pas
r197 r198 46 46 Label12: TLabel; 47 47 Label13: TLabel; 48 Label14: TLabel; 48 49 Label2: TLabel; 49 50 Label3: TLabel; … … 64 65 OpenPictureDialog1: TOpenPictureDialog; 65 66 PageControl1: TPageControl; 67 PageControl2: TPageControl; 66 68 PanelButtons: TPanel; 67 69 PanelChat: TPanel; … … 73 75 RadioGroupGrowAmount: TRadioGroup; 74 76 RadioGroupGrowCells: TRadioGroup; 75 SpinEditTurns: TSpinEdit;76 77 SpinEditMaxPower: TSpinEdit; 77 78 SpinEditServerPort: TSpinEdit; … … 80 81 SpinEditMapSizeY: TSpinEdit; 81 82 SpinEditNeutralUnits: TSpinEdit; 83 SpinEditSpecialCells: TSpinEdit; 84 SpinEditTurns: TSpinEdit; 82 85 SpinEditVoidPercent: TSpinEdit; 83 86 Splitter1: TSplitter; … … 85 88 TabSheet2: TTabSheet; 86 89 TabSheet3: TTabSheet; 90 TabSheetStayAliveTurns: TTabSheet; 91 TabSheetCaptureCells: TTabSheet; 92 TabSheetDefeatEnemies: TTabSheet; 93 TabSheetCaptureCities: TTabSheet; 87 94 TabSheetMode: TTabSheet; 88 95 TrackBarSizeX: TTrackBar; … … 98 105 procedure CheckBoxVoidChange(Sender: TObject); 99 106 procedure ComboBoxMapShapeChange(Sender: TObject); 107 procedure ComboBoxWinObjectiveChange(Sender: TObject); 100 108 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 101 109 procedure FormCreate(Sender: TObject); … … 151 159 SWinObjectiveDefeatAllOponents = 'Defeat all oponents'; 152 160 SWinObjectiveDefeatAllCities = 'Defeat all oponents cities'; 153 SWinObjectiveCapturePosition = 'Capture position';161 SWinObjectiveCapturePosition = 'Capture all special cells'; 154 162 SWinObjectiveStayAliveForTurns = 'Stay alive for number of turns'; 155 163 SGrowNone = 'None'; … … 371 379 begin 372 380 ReloadView; 381 end; 382 383 procedure TFormNew.ComboBoxWinObjectiveChange(Sender: TObject); 384 begin 385 PageControl2.TabIndex := ComboBoxWinObjective.ItemIndex; 373 386 end; 374 387 … … 504 517 SpinEditMaxPower.Value := Game.MaxPower; 505 518 SpinEditTurns.Value := Game.StayAliveForDefinedTurns; 519 SpinEditSpecialCells.Value := Game.SpecialCaptureCellCount; 506 520 end; 507 521 end; … … 540 554 Game.MaxPower := SpinEditMaxPower.Value; 541 555 Game.StayAliveForDefinedTurns := SpinEditTurns.Value; 556 Game.SpecialCaptureCellCount := SpinEditSpecialCells.Value; 542 557 end; 543 558 end; -
trunk/Languages/xtactics.cs.po
r197 r198 402 402 msgid "Number of turns:" 403 403 msgstr "Počet tahů:" 404 405 #: tformnew.label14.caption 406 msgid "Special cells count:" 407 msgstr "Počet speciálních buněk:" 404 408 405 409 #: tformnew.label2.caption … … 848 852 849 853 #: uformnew.swinobjectivecaptureposition 850 msgid "Capture position"851 msgstr "Dobít pozici"854 msgid "Capture all special cells" 855 msgstr "Dobít všechny speciální buňky" 852 856 853 857 #: uformnew.swinobjectivedefeatallcities … … 960 964 msgid "64-bit UInt read overflow." 961 965 msgstr "Přetečení při čtení 64-bit UInt" 966 -
trunk/Languages/xtactics.po
r197 r198 387 387 #: tformnew.label13.caption 388 388 msgid "Number of turns:" 389 msgstr "" 390 391 #: tformnew.label14.caption 392 msgid "Special cells count:" 389 393 msgstr "" 390 394 … … 827 831 828 832 #: uformnew.swinobjectivecaptureposition 829 msgid "Capture position"833 msgid "Capture all special cells" 830 834 msgstr "" 831 835 -
trunk/UGame.pas
r197 r198 30 30 31 31 TTerrainType = (ttVoid, ttNormal, ttCity); 32 TExtraType = (etNone, etObjectiveTarget, etAttack, etDefense, etLookout, 33 etGrowLow, etGrowMedium, etGrowHigh); 32 34 33 35 { TCell } … … 55 57 Angle: Double; // Temporary value 56 58 Links: TCellLinks; 59 Extra: TExtraType; 57 60 procedure ConnectTo(Cell: TCell); 58 61 procedure DisconnectFrom(Cell: TCell); … … 85 88 function FindById(Id: Integer): TCell; 86 89 procedure GetCellsWithWeight(List: TCells; Low, High: Integer); 90 procedure GetCellsWithExtra(List: TCells; Extra: TExtraType); 87 91 procedure LoadFromNode(Node: TDOMNode); 88 92 procedure SaveToNode(Node: TDOMNode); … … 439 443 procedure PropagatePlayerDistance(List: TCells); 440 444 procedure InitDefaultPlayersSetting; 445 procedure WinObjectiveMapPrepare; 441 446 public 442 447 DevelMode: Boolean; … … 455 460 TurnCounter: Integer; 456 461 WinObjective: TWinObjective; 457 SpecialCaptureCell : TCell;462 SpecialCaptureCellCount: Integer; 458 463 StayAliveForDefinedTurns: Integer; 459 464 MaxNeutralUnits: Integer; … … 1020 1025 if (Cell.Terrain <> ttVoid) and (Cell.Weight >= Low) and 1021 1026 (Cell.Weight <= High) then List.Add(Cell); 1027 end; 1028 1029 procedure TCells.GetCellsWithExtra(List: TCells; Extra: TExtraType); 1030 var 1031 Cell: TCell; 1032 begin 1033 List.Clear; 1034 for Cell in Self do 1035 if Cell.Extra = Extra then List.Add(Cell); 1022 1036 end; 1023 1037 … … 1496 1510 TextSize: TSize; 1497 1511 begin 1512 if Cell.Extra = etObjectiveTarget then begin 1513 Text := Text + '!'; 1514 end; 1498 1515 with Canvas do begin 1499 1516 if Assigned(View.FocusedCell) and (View.FocusedCell = Cell) then begin … … 1526 1543 1527 1544 // Show cell text 1528 if Text <> '0'then begin1545 if Cell.GetAvialPower <> 0 then begin 1529 1546 Pen.Style := psSolid; 1530 1547 Font.Color := clWhite; … … 1890 1907 Power := ReadInteger(Node, 'Power', 0); 1891 1908 Terrain := TTerrainType(ReadInteger(Node, 'Terrain', Integer(ttVoid))); 1909 Extra := TExtraType(ReadInteger(Node, 'Extra', Integer(etNone))); 1892 1910 PosPx.X := ReadInteger(Node, 'PosX', 0); 1893 1911 PosPx.Y := ReadInteger(Node, 'PosY', 0); … … 1925 1943 WriteInteger(Node, 'Power', Power); 1926 1944 WriteInteger(Node, 'Terrain', Integer(Terrain)); 1945 WriteInteger(Node, 'Extra', Integer(Extra)); 1927 1946 WriteInteger(Node, 'PosX', PosPx.X); 1928 1947 WriteInteger(Node, 'PosY', PosPx.Y); … … 2966 2985 PaintCell(Canvas, Cell.PosPx, IntToStr(Cell.GetAvialPower), View, Cell); 2967 2986 end; 2968 2969 2987 end; 2970 2988 … … 3188 3206 end; 3189 3207 3208 procedure TGame.WinObjectiveMapPrepare; 3209 var 3210 Cell: TCell; 3211 Cells: TCells; 3212 I: Integer; 3213 begin 3214 if WinObjective = woSpecialCaptureCell then begin 3215 Cells := TCells.Create(False); 3216 for I := 0 to Map.Cells.Count - 1 do 3217 if (Map.Cells[I].Terrain <> ttVoid) and (Map.Cells[I].Extra <> etObjectiveTarget) then 3218 Cells.Add(Map.Cells[I]); 3219 3220 for I := 0 to SpecialCaptureCellCount - 1 do begin 3221 if Cells.Count = 0 then Break; 3222 Cell := Cells[Random(Cells.Count)]; 3223 Cell.Extra := etObjectiveTarget; 3224 Cells.Remove(Cell); 3225 end; 3226 Cells.Free; 3227 end; 3228 end; 3229 3190 3230 procedure TGame.SaveConfig(Config: TXmlConfig; Path: string); 3191 3231 begin … … 3207 3247 SetValue(DOMString(Path + '/WinObjective'), Integer(WinObjective)); 3208 3248 SetValue(DOMString(Path + '/StayAliveForDefinedTurns'), StayAliveForDefinedTurns); 3249 SetValue(DOMString(Path + '/SpecialCaptureCellCount'), SpecialCaptureCellCount); 3209 3250 PlayersSetting.SaveConfig(Config, Path + '/Players'); 3210 3251 end; … … 3240 3281 WinObjective := TWinObjective(Value) else WinObjective := Low(TWinObjective); 3241 3282 StayAliveForDefinedTurns := GetValue(DOMString(Path + '/StayAliveForDefinedTurns'), 20); 3283 SpecialCaptureCellCount := GetValue(DOMString(Path + '/SpecialCaptureCellCount'), 1); 3242 3284 PlayersSetting.LoadConfig(Config, Path + '/Players'); 3243 3285 end; … … 3412 3454 AlivePlayers: TPlayerArray; 3413 3455 Winner: TPlayer; 3456 Cells: TCells; 3457 Player: TPlayer; 3458 R: Boolean; 3459 I: Integer; 3414 3460 begin 3415 3461 Winner := nil; … … 3429 3475 end else 3430 3476 if WinObjective = woSpecialCaptureCell then begin 3431 if Assigned(SpecialCaptureCell) and Assigned(SpecialCaptureCell.Player) then 3432 EndGame(SpecialCaptureCell.Player); 3477 Cells := TCells.Create(False); 3478 Map.Cells.GetCellsWithExtra(Cells, etObjectiveTarget); 3479 R := True; 3480 for I := 0 to Cells.Count - 1 do begin 3481 if I = 0 then Player := Cells[I].Player; 3482 if not Assigned(Cells[I].Player) or (Cells[I].Player <> Player) then begin 3483 R := False; 3484 Break; 3485 end; 3486 end; 3487 if R then EndGame(Player); 3488 Cells.Free; 3433 3489 end else 3434 3490 if WinObjective = woStayAliveForDefinedTurns then begin … … 3485 3541 Map.MaxPower := MaxPower; 3486 3542 BuildTerrain; 3543 WinObjectiveMapPrepare; 3487 3544 3488 3545 // Build bridges -
trunk/xtactics.lpi
r196 r198 244 244 <IsPartOfProject Value="True"/> 245 245 <ComponentName Value="FormServer"/> 246 <HasResources Value="True"/> 246 247 <ResourceBaseClass Value="Form"/> 247 248 </Unit24> … … 278 279 <Linking> 279 280 <Debugging> 280 <UseHeaptrc Value="True"/>281 281 <UseExternalDbgSyms Value="True"/> 282 282 </Debugging> -
trunk/xtactics.lpr
r196 r198 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.