Changeset 265 for trunk/UClientGUI.pas


Ignore:
Timestamp:
Jan 15, 2019, 1:03:40 AM (6 years ago)
Author:
chronos
Message:
  • Modified: Cell power is now internally represented as unit power (TUnit class).
  • Modified: Allow to have only one player in the game.
  • Added: New win objective None to just play freely without any win objective.
  • Added: New win objective to capture entire map.
  • Added: TGameSystem class to represent various game play systems of other existing games.
  • Fixed: Clear correctly defender player from unit moves if his cell is captured.
  • Fixed: Do not allow to remove too many players to have at least minimum players.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UClientGUI.pas

    r257 r265  
    190190
    191191    // Show cell text
    192     if (Cell.Power <> 0) or (Cell.Extra = etObjectiveTarget) then begin
     192    if (Cell.OneUnit.Power <> 0) or (Cell.Extra = etObjectiveTarget) then begin
    193193      Pen.Style := psSolid;
    194194      Font.Color := clWhite;
     
    319319          if Cell.MapCell.Player = ControlPlayer then
    320320            CellText := IntToStr(Cell.GetAvialPower)
    321             else CellText := IntToStr(Cell.MapCell.Power);
     321            else begin
     322              if Assigned(Cell.MapCell.OneUnit) then
     323                CellText := IntToStr(Cell.MapCell.OneUnit.Power)
     324                else CellText := '';
     325            end;
    322326          if Assigned(SelectedCell) and (SelectedCell = Cell) then
    323327              Brush.Color := clGreen
     
    349353        if (MapCell.Terrain <> ttVoid) and View.IsCellVisible(MapCell) then begin
    350354          Brush.Color := MapCell.GetColor;
    351           PaintMapCell(Canvas, MapCell.PosPx, IntToStr(MapCell.Power), View, MapCell);
     355          if Assigned(Cell.MapCell.OneUnit) then
     356            CellText := IntToStr(MapCell.OneUnit.Power)
     357            else CellText := '';
     358          PaintMapCell(Canvas, MapCell.PosPx, CellText, View, MapCell);
    352359        end;
    353360      end;
     
    514521          Player.Moves.Remove(SelectedCell.MovesFrom[I]);
    515522        end;
    516         TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.Power, False);
     523        TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power, False);
    517524        SelectedCell := nil;
    518525      end else
     
    522529        for I := SelectedCell.MovesFrom.Count - 1 downto 0 do
    523530          Player.Moves.Remove(SelectedCell.MovesFrom[I]);
    524         UnitMove := TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.Power, False);
     531        UnitMove := TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power, False);
    525532        if Assigned(UnitMove) then
    526533          UnitMove.CountRepeat := TGame(Player.Game).Map.MaxPower;
     
    528535          else SelectedCell := nil;
    529536      end else begin
    530         TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.Power);
     537        TGame(Game).CurrentPlayer.SetMove(SelectedCell, NewSelectedCell, SelectedCell.MapCell.OneUnit.Power);
    531538        SelectedCell := nil;
    532539      end;
Note: See TracChangeset for help on using the changeset viewer.