Changeset 415


Ignore:
Timestamp:
Jan 10, 2025, 8:51:02 PM (4 hours ago)
Author:
chronos
Message:
  • Fixed: Do not show player win dialog if there is only one player in the game.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Game.pas

    r414 r415  
    872872begin
    873873  Winner := nil;
    874   if WinObjective = woDefeatAllOponents then begin
     874  if (WinObjective = woDefeatAllOponents) and (Players.Count > 1) then begin
    875875    AlivePlayers := Players.GetAlivePlayers;
    876876    if (Length(AlivePlayers) <= 1) then begin
  • trunk/View.pas

    r404 r415  
    142142  R: TRect;
    143143begin
    144   if TGame(Game).Map.Cyclic then begin
    145     R := CellToCanvasRect(TGame(Game).Map.PixelRect);
     144  if Game.Map.Cyclic then begin
     145    R := CellToCanvasRect(Game.Map.PixelRect);
    146146    CellPos := TPoint.Create(
    147147      ModNeg(Pos.X - R.P1.X, R.Size.X) + R.P1.X,
     
    156156  if Assigned(NewSelectedCell) then begin
    157157    if Assigned(SelectedCell) and (NewSelectedCell <> SelectedCell) and
    158     TGame(Game).CurrentPlayer.IsAllowedMoveTarget(SelectedCell, NewSelectedCell) then begin
     158    Game.CurrentPlayer.IsAllowedMoveTarget(SelectedCell, NewSelectedCell) then begin
    159159      if ssShift in ShiftState then begin
    160160        // Make maximum unit move without confirmation dialog
     
    162162          Player.Moves.Remove(SelectedCell.MovesFrom[I]);
    163163        end;
    164         TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power, False);
     164        Game.CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power, False);
    165165        SelectedCell := nil;
    166166      end else
     
    170170        for I := SelectedCell.MovesFrom.Count - 1 downto 0 do
    171171          Player.Moves.Remove(SelectedCell.MovesFrom[I]);
    172         UnitMove := TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power, False);
     172        UnitMove := Game.CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power, False);
    173173        if Assigned(UnitMove) then
    174174          UnitMove.CountRepeat := TGame(Player.Game).Map.MaxPower;
     
    176176          else SelectedCell := nil;
    177177      end else begin
    178         TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power);
     178        Game.CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power);
    179179        SelectedCell := nil;
    180180      end;
     
    193193  MapRect: TRect;
    194194begin
    195   MapRect := TGame(Game).Map.PixelRect;
     195  MapRect := Game.Map.PixelRect;
    196196  SourceRect := TRect.CreateBounds(TPoint.Create(MapRect.P1.X + MapRect.Size.X div 2 - SourceRect.Size.X div 2,
    197197    MapRect.P1.Y + MapRect.Size.Y div 2 - SourceRect.Size.Y div 2),
     
    214214  NewZoom: Single;
    215215begin
    216   MapRect := TGame(Game).Map.CalculatePixelRect;
     216  MapRect := Game.Map.CalculatePixelRect;
    217217  Factor := TPointF.Create(DestRect.Size.X / MapRect.Size.X,
    218218    DestRect.Size.Y / MapRect.Size.Y);
Note: See TracChangeset for help on using the changeset viewer.