Changeset 376
Legend:
- Unmodified
- Added
- Removed
-
trunk/Map.pas
r345 r376 682 682 OtherCell1: TCell; 683 683 OtherCell2: TCell; 684 Cell: TCell; 684 685 OppositeCell: TCell; 685 686 begin 686 687 // Generic way to create two sides symetric map independent to shape 688 // Set first half as inverted second half 687 689 for C := 0 to (Cells.Count div 2) - 1 do begin 688 Cells[C].Terrain := Cells[Cells.Count - 1 - C].Terrain; 690 Cell := Cells[C]; 691 OppositeCell := Cells[Cells.Count - 1 - C]; 692 693 Cell.Terrain := OppositeCell.Terrain; 689 694 690 695 // Sync units 691 if not Assigned(Cells[C].OneUnit) and Assigned(Cells[Cells.Count - 1 - C].OneUnit) then begin 692 Cells[C].OneUnit := TGame(Game).Units.AddNew(Cells[Cells.Count - 1 - C].OneUnit.Kind, 693 Cells[Cells.Count - 1 - C].OneUnit.Power); 694 end; 695 if Assigned(Cells[C].OneUnit) and Assigned(Cells[Cells.Count - 1 - C].OneUnit) then 696 Cells[C].OneUnit.Power := Cells[Cells.Count - 1 - C].OneUnit.Power; 697 698 if Assigned(Cells[C].OneUnit) and not Assigned(Cells[Cells.Count - 1 - C].OneUnit) then begin 699 TGame(Game).Units.Remove(Cells[C].OneUnit); 700 end; 701 702 for I := Cells[C].Links.Count - 1 downto 0 do begin 703 CellLink := Cells[C].Links[I]; 696 if not Assigned(Cell.OneUnit) and Assigned(OppositeCell.OneUnit) then begin 697 Cell.OneUnit := TGame(Game).Units.AddNew(OppositeCell.OneUnit.Kind, 698 OppositeCell.OneUnit.Power); 699 end; 700 if Assigned(Cell.OneUnit) and Assigned(OppositeCell.OneUnit) then begin 701 Cell.OneUnit.Kind := OppositeCell.OneUnit.Kind; 702 Cell.OneUnit.Power := OppositeCell.OneUnit.Power; 703 end; 704 705 if Assigned(Cell.OneUnit) and not Assigned(OppositeCell.OneUnit) then begin 706 TGame(Game).Units.Remove(Cell.OneUnit); 707 end; 708 709 for I := Cell.Links.Count - 1 downto 0 do begin 710 CellLink := Cell.Links[I]; 704 711 705 712 // Remove cells on first half of the map … … 734 741 // Make copy of links from second half 735 742 OppositeCell := Cells[Cells.Count - 1 - C]; 743 736 744 for CellLink in OppositeCell.Links do 737 745 if (Cells.IndexOf(CellLink.Cells[0]) > (Cells.Count div 2)) and -
trunk/Units.pas
r375 r376 237 237 destructor TUnit.Destroy; 238 238 begin 239 MapCell := nil; 239 240 Player := nil; 240 241 inherited;
Note:
See TracChangeset
for help on using the changeset viewer.