Changeset 298 for trunk/UGame.pas
- Timestamp:
- Jul 10, 2019, 5:35:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r294 r298 330 330 if not GeneratePlayers then Exit; 331 331 332 for Player in Playersdo begin333 Player.Reset;334 Player.StartCell := nil;335 end; 336 I := 0;337 for Player in Players do338 with Player do begin332 for I := 0 to Players.Count - 1 do begin 333 TPlayer(Players[I]).Reset; 334 TPlayer(Players[I]).StartCell := nil; 335 end; 336 for I := 0 to Players.Count - 1 do 337 with TPlayer(Players[I]) do begin 338 Player := TPlayer(Players[I]); 339 339 PlayerMap.Update; 340 340 if (Map.Size.X > 0) and (Map.Size.Y > 0) then begin … … 342 342 if Assigned(Player.StartCell) then begin 343 343 if SymetricMap and (I = 1) then 344 StartCell := Map.Cells[Map.Cells.Count - 1 - Map.Cells.IndexOf( Players[0].StartCell)];344 StartCell := Map.Cells[Map.Cells.Count - 1 - Map.Cells.IndexOf(TPlayer(Players[0]).StartCell)]; 345 345 346 346 if CityEnabled then begin … … 358 358 InitUnitMoves; 359 359 PlayerMap.CheckVisibility; 360 Inc(I);361 360 end; 362 361 end; … … 411 410 Player: TPlayer; 412 411 List: TCells; 413 begin 414 for Player in Players do 415 if Assigned(Player.StartCell) then begin 416 Player.StartCell.Weight := 1; 417 Player.StartCell.Mark := True; 418 List := TCells.Create; 419 List.FreeObjects := False; 420 List.Add(Player.StartCell); 421 PropagatePlayerDistance(List); 422 FreeAndNil(List); 412 I: Integer; 413 begin 414 for I := 0 to Players.Count - 1 do begin 415 Player := TPlayer(Players[I]); 416 if Assigned(Player.StartCell) then begin 417 Player.StartCell.Weight := 1; 418 Player.StartCell.Mark := True; 419 List := TCells.Create; 420 List.FreeObjects := False; 421 List.Add(Player.StartCell); 422 PropagatePlayerDistance(List); 423 FreeAndNil(List); 424 end; 423 425 end; 424 426 end; … … 568 570 MaxNeutralUnits := GetValue(DOMString(Path + '/MaxNeutralUnits'), 5); 569 571 MaxPower := GetValue(DOMString(Path + '/MaxPower'), 99); 572 GameSystemName := string(GetValue(DOMString(Path + '/GameSystemName'), DOMString(''))); 570 573 Players.LoadConfig(Config, Path + '/Players'); 571 GameSystemName := string(GetValue(DOMString(Path + '/GameSystemName'), DOMString('')));572 574 end; 573 575 end; … … 617 619 if Assigned(NewNode) then 618 620 Players.LoadFromNode(NewNode); 619 if Players.Count > 0 then CurrentPlayer := Players[0]621 if Players.Count > 0 then CurrentPlayer := TPlayer(Players[0]) 620 622 else CurrentPlayer := nil; 621 623 … … 628 630 629 631 for I := 0 to Players.Count - 1 do begin 630 Players[I].PlayerMap.Update;631 Players[I].PlayerMap.CheckVisibility;632 TPlayer(Players[I]).PlayerMap.Update; 633 TPlayer(Players[I]).PlayerMap.CheckVisibility; 632 634 end; 633 635 ComputePlayerStats; … … 700 702 begin 701 703 for I := 0 to Players.Count - 1 do 702 with Players[I]do begin704 with TPlayer(Players[I]) do begin 703 705 TotalUnits := 0; 704 706 TotalCells := 0; … … 721 723 begin 722 724 for I := 0 to Players.Count - 1 do 723 with Players[I]do begin725 with TPlayer(Players[I]) do begin 724 726 NewStat := TGameTurnStat.Create; 725 727 NewStat.DiscoveredCells := TotalDiscovered; … … 770 772 NewPlayerIndex := NewPlayerIndex mod AlivePlayers.Count; 771 773 end; 772 CurrentPlayer := AlivePlayers[NewPlayerIndex];774 CurrentPlayer := TPlayer(AlivePlayers[NewPlayerIndex]); 773 775 finally 774 776 AlivePlayers.Free; … … 895 897 I: Integer; 896 898 begin 897 for I := 0 to Players.Count - 1 do Players[I].Clear;899 for I := 0 to Players.Count - 1 do TPlayer(Players[I]).Clear; 898 900 Map.Clear; 899 901 end; … … 922 924 923 925 InitPlayers; 924 if Players.Count > 0 then CurrentPlayer := Players[0]926 if Players.Count > 0 then CurrentPlayer := TPlayer(Players[0]) 925 927 else CurrentPlayer := nil; 926 928
Note:
See TracChangeset
for help on using the changeset viewer.