Changeset 81 for trunk/UGame.pas
- Timestamp:
- Nov 4, 2014, 11:17:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r80 r81 200 200 end; 201 201 202 { TPlayerCell } 203 204 TPlayerCell = class 205 Explored: Boolean; 206 InVisibleRange: Boolean; 207 MapCell: TCell; 208 end; 209 210 { TPlayerCells } 211 212 TPlayerCells = class(TObjectList) 213 214 end; 215 216 { TPlayerMap } 217 218 TPlayerMap = class 219 Cells: TPlayerCells; 220 constructor Create; 221 destructor Destroy; override; 222 end; 223 202 224 TPlayerMode = (pmHuman, pmComputer); 203 225 … … 219 241 StartUnits: Integer; 220 242 StartCell: TCell; 243 PlayerMap: TPlayerMap; 221 244 procedure LoadFromNode(Node: TDOMNode); 222 245 procedure SaveToNode(Node: TDOMNode); … … 234 257 Game: TGame; 235 258 Targets: TObjectList; 259 CellProcessDirection: Boolean; 236 260 procedure AttackNeutral; 237 261 procedure AttackPlayers; … … 441 465 end; 442 466 467 { TPlayerMap } 468 469 constructor TPlayerMap.Create; 470 begin 471 Cells := TPlayerCells.Create; 472 end; 473 474 destructor TPlayerMap.Destroy; 475 begin 476 Cells.Free; 477 inherited Destroy; 478 end; 479 443 480 { TCanvasEx } 444 481 … … 1580 1617 end; 1581 1618 1619 if CellProcessDirection then begin 1620 // Reverse array 1621 for I := 0 to (TargetCells.Count div 2) - 1 do 1622 TargetCells.Exchange(I, TargetCells.Count - 1 - I); 1623 end; 1624 1582 1625 // Unset mark for all cells 1583 1626 for C := 0 to AllCells.Count - 1 do … … 1643 1686 InnerMoves; 1644 1687 IncreaseMoves; 1688 CellProcessDirection := not CellProcessDirection; 1645 1689 end; 1646 1690 … … 1684 1728 StartUnits := DefaultPlayerStartUnits; 1685 1729 StartCell := nil; 1730 PlayerMap := TPlayerMap.Create; 1686 1731 end; 1687 1732 1688 1733 destructor TPlayer.Destroy; 1689 1734 begin 1735 FreeAndNil(PlayerMap); 1690 1736 FreeAndNil(View); 1691 1737 inherited Destroy;
Note:
See TracChangeset
for help on using the changeset viewer.