Changeset 211 for trunk/UGame.pas


Ignore:
Timestamp:
May 23, 2018, 8:53:58 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Each client form is redrawn by itself, not by Core.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r210 r211  
    31763176  // Select new player from alive players
    31773177  AlivePlayers := TPlayers.Create(False);
    3178   Players.GetAlivePlayers(AlivePlayers);
    3179   NewPlayerIndex := AlivePlayers.IndexOf(CurrentPlayer) + 1;
    3180   if NewPlayerIndex >= AlivePlayers.Count then begin
    3181     // Start of turn
    3182     Inc(TurnCounter);
    3183     RecordTurnStats;
    3184     if Assigned(FOnNewTurn) then
    3185       FOnNewTurn(Self);
    3186     NewPlayerIndex := NewPlayerIndex mod AlivePlayers.Count;
    3187   end;
    3188   CurrentPlayer := AlivePlayers[NewPlayerIndex];
     3178  try
     3179    Players.GetAlivePlayers(AlivePlayers);
     3180    NewPlayerIndex := AlivePlayers.IndexOf(CurrentPlayer) + 1;
     3181    if NewPlayerIndex >= AlivePlayers.Count then begin
     3182      // Start of turn
     3183      Inc(TurnCounter);
     3184      RecordTurnStats;
     3185      if Assigned(FOnNewTurn) then
     3186        FOnNewTurn(Self);
     3187      NewPlayerIndex := NewPlayerIndex mod AlivePlayers.Count;
     3188    end;
     3189    CurrentPlayer := AlivePlayers[NewPlayerIndex];
     3190  finally
     3191    AlivePlayers.Free;
     3192  end;
    31893193
    31903194  if Assigned(FOnPlayerChange) then
Note: See TracChangeset for help on using the changeset viewer.